1,175 Posted Topics
Re: I assume that livewires is just a wrapper for Python and Tkinter using a different syntax. The syntax might be easier to understand for youngsters, but simply adds another layer of potential errors. I don't think very many folks use this module. I am not even sure where to get … | |
Re: I too think your lambda is not corrct. Try this: [code=python]import tkHyperlinkManager #external lib from Tkinter import * i = 0 li_all = [0, 1, 2, 3, 4] #dynamic list root = Tk() root.title("Test") text = Text(root) text.pack() hyperlink = tkHyperlinkManager.HyperlinkManager(text) def call(x): print x while i <= 3: text.insert(INSERT, … | |
Re: Nice solution Mitko, can even be made mildly simpler: [code=python] listsorted = sorted(listunsorted, key=lambda x: x[0]) [/code] | |
Re: [QUOTE=Ancient Dragon;589221]Pizza may be one of America's favorite fast foods but [URL="http://www.straightdope.com/mailbag/mpizza.html"]was invented[/URL] long long before the Americas were discovered.[/QUOTE]... and so was apple pie! Maybe the Chinese did it! Not quite sure what would be America's most popular food, a slice of pizza, a hot dog, a taco, or … | |
Re: Well, you are calling the read_number() function twice, so it will pop up twice. I don't have the livewires module, so I have to guess: [code=python]from livewires import * rn = random_between(1,15) rn1 = random_between(1,15) print 'what is', rn , 'times', rn1, '? ', answer = read_number() if answer == … | |
Re: Use replace(): [code=python]s = "word one word two" # replace space with no-space ms = s.replace(' ', '') print ms # wordonewordtwo [/code] | |
Re: There is a forum for just this kind of stuff at DaniWeb: [url]http://www.daniweb.com/forums/forum38.html[/url] This way you don't need the scare the rest of us with Windows Vista! | |
Re: [QUOTE=jbennet;588257]LOL[/QUOTE]LOL to you too! Wow, this blog is a real good take on AH (artificial humour). | |
| |
Re: [QUOTE=~s.o.s~;578580]I got one when I joined Daniweb around 2 years back, though I must admit it was more along the lines of the moderator not knowing what an infraction was meant for considering the infraction feature was newly introduced. ;-)[/QUOTE]Well, an honorary infraction like that is a nice feather on … | |
Re: Jwenting's second helicopter looks a little like a French made Alouette? | |
Re: A lot of programmers use both Java and Python. Python has the advantage of a much more rapid learning and program development phase. So I would learn Python first. Once you learn Python you can access Java libaries easily with Jython, also open source. | |
Re: We all know, but we don't do your homework! Read the DaniWeb rules. | |
Re: bachmabt's solution works in your case where you have: nested_list = [[1,2,3],[5,6,7],[9,10,11]] but for more complex nesting like: nested_list = [[1,2,3],[5,6,7],[9,[10,11]]] you may have eventually flatten the list. | |
Re: I am really not a mind reader, so show us some code that gives the error! | |
Re: Be aware that there is a namspace conflict with class Image: [code=python]# load and display an image with Tkinter # Tkinter only reads gif and ppm images # use Python Image Library (PIL) for other image formats # give Tkinter a namespace to avoid conflicts with PIL # (they both … | |
Re: I have found some bugs just using the Python debugger module pdb: [code=python]# test the built-in Python Debugger (Pdb in the Python reference) # at the debugger's '(Pdb)' prompt you can type h for help or # more specifically use h step or h next import pdb #help('pdb') # once … | |
Re: Genarally this is done this way: [code=python]def get_int(low, high): """ the function will loop until an integer number within the given low and high range has been entered """ prompt = "Enter an integer number between %d and %d: " % (low, high) while True: try: n = int(raw_input(prompt)) if … | |
Re: Here is an example that should get most of the way there. All you need to do is to supply the search string from the listbox selection: [code=python]# searching a long text for a string and scrolling to it # use ctrl+c to copy, ctrl+x to cut selected text, # … | |
Re: That sort of thing is usually done by subprocess.Popen() or os.popen() functions. | |
Re: Somebody forgot the corkscrew and for several days we had to live on nothing but food and water. -- WC Fields | |
Re: [QUOTE=ZZucker;551375]The Israeli Army is the best Army in the world! If they would have been allowed to do the Iraq thing, they would have been in and out in five days.[/QUOTE]The Israeli Army should be good, the US taxpayer pays for them. | |
Re: See, 'The Dude' has no nasty bone in his/her body! BTW Dude, have you ever pulled up the source code for this site? Very nice HTML ad JavaScript. | |
| |
Re: He is one talented hombre! Good find there Dude, another very funny site. Thank you! | |
Re: Here is the spiel: [code]a += b Roughly equivalent to a = a + b a -= b Roughly equivalent to a = a - b a *= b Roughly equivalent to a = a * b a /= b Roughly equivalent to a = a / b a //= … | |
Re: I keep feeding it all sorts of passwords, but still can't get in! | |
Re: Sounds like you want something lke this: [code=python]def ask_hours(): return input ("How many hours do you want to convert? ") def calc_minutes(hours): minutes = hours * 60 print "There are", minutes, "minutes in", hours, "hours." def main() : hours = ask_hours() calc_minutes(hours) main() [/code]You have ywo types of functions here, … | |
Re: Please stick to established Python coding rules, you code is hard to read: [code=python]import Tkinter as tk from PIL import Image, ImageTk def show_image(): """image object image1 created in main""" canvas.create_image(250, 250, image=image1) #canvas.update() frame = tk.Frame() frame.pack() canvas = tk.Canvas(frame, bg='white', width=500, height=500) canvas.pack() button = tk.Button(frame, fg="blue", text="Insert … | |
Re: The other question should be: "Who of the richest folks pays the most tax?" | |
| |
Re: I think it behaves perfectly fine, here is my output: [code]1.0 1.0 1.0 0.0 2.0 1.41421356237 1.41421356237 1.59472435257e-012 3.0 1.73205081001 1.73205080757 2.44585018905e-009 4.0 2.00000000003 2.0 2.62145860574e-011 5.0 2.23606798501 2.2360679775 7.51019246792e-009 6.0 2.44948974278 2.44948974278 6.2172489379e-015 7.0 2.64575131106 2.64575131106 3.66817687336e-013 8.0 2.82842712475 2.82842712475 6.9610983644e-012 9.0 3.00000000007 3.0 6.61648513756e-011 [/code]Also remember that most … | |
Re: Ah, the home shopping channels. They are proof for the old saying that a fool and his/her money are soon parted. | |
Re: [QUOTE=~s.o.s~;556126]Something one can wear on his hand and use it to rip out someones' intestines.[/QUOTE]A surgical tool? | |
Re: You need to convert your integer into a string, iterate the string and sum up the string's numeric characters as integers. If n is your integer, then str(n) is the string. If c is the string's numeric character, then int(c) is its numeric/integer value. Use a for loop to iterate … | |
Re: On problem #1 you want the sum of squares: [code=python]def times(y): sum = 0 for i in range(1, y+1): # you want the sum of squares sum += i * i return sum def main(): x = input("Enter a number: ") w = times(x) print w main() [/code]This looks a … | |
Re: FYI, parts of Ohio (USA) got 2 feet of snow and we are looking the upcoming tornado season right in the eye. Makes life interesting. | |
What are the most annoying things people around you do? One of my pet peeves: Some "know it all" old timer treats you like a little kid, just because you are young and he/she is not too bright. | |
Re: I don't care what you say, but you cannot learn C++ in 2 hours! | |
Re: Python30 introduces quite a number of major changes to the Python code syntax. I would not use it at this point until it is the official release (end of 2008 projected release date). | |
Re: Take a look at this Tkinter GUI Builder: [url]http://spectcl.sourceforge.net/spectcl.html[/url] I downloaded the Windows exe file and it works quite well. The target lanuages of the produced code are TCL, Java, HTML, Perl or Python. As with most builders the code is a little wordy, but it works! | |
Re: Your error is most likely here: finalval = finalval + newlist(i2) you probably mean: finalval = finalval + newlist[i2] Also check the other list indexes. () would be a call, [] is used for indexed list element. It also would help to be a bit more specific in your thread … | |
Transportation uses a lot of energy, so when you talk about alternate energy then alternate transportation becomes an important issue. What forms of transportation would you consider in your situation to minimize energy consumption? Would it be a petrol saving minicar? Just in the news, Tata, an Indian carmaker just … | |
Let the rest of us know what your dreams are about. One of my reoccuring dreams is a trip to somewhere important, but I get stopped by a flooded river. The water is fast flowing but absolutely clear, so I can see the depth of the flood waters. In the … | |
| |
Re: The mass media (or most of it) have a strict far-right political agenda and will refuse to publish things that don't fit that agenda. A good example is Fox News in the US. I wonder if bias is a form of cencorship. Fox News is the only channel our VP … | |
Re: [QUOTE=jbennet;548156]... btw i find tall girls with glasses, brown hair and curves amazingly sexy[/QUOTE]I am agreeing with you there. I love girls that know how to walk attractively and are not too shy about it. |
The End.