1,175 Posted Topics

Member Avatar for blade321

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 …

Member Avatar for jrcagle
0
109
Member Avatar for hudson5cp

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, …

Member Avatar for hudson5cp
0
153
Member Avatar for billabong2388

Nice solution Mitko, can even be made mildly simpler: [code=python] listsorted = sorted(listunsorted, key=lambda x: x[0]) [/code]

Member Avatar for vegaseat
0
154
Member Avatar for The Dude

[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 …

Member Avatar for The Dude
2
108
Member Avatar for blade321

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 == …

Member Avatar for sneekula
0
79
Member Avatar for StepIre

Use replace(): [code=python]s = "word one word two" # replace space with no-space ms = s.replace(' ', '') print ms # wordonewordtwo [/code]

Member Avatar for sneekula
0
279
Member Avatar for djm123

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!

Member Avatar for sneekula
0
38
Member Avatar for Alvin Phillips

[QUOTE=jbennet;588257]LOL[/QUOTE]LOL to you too! Wow, this blog is a real good take on AH (artificial humour).

Member Avatar for sneekula
0
107
Member Avatar for gehher
Member Avatar for lio04
0
306
Member Avatar for steven woodman

[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 …

Member Avatar for jbennet
0
237
Member Avatar for vegaseat

Jwenting's second helicopter looks a little like a French made Alouette?

Member Avatar for jwenting
1
1K
Member Avatar for fongoos

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.

Member Avatar for linux
0
823
Member Avatar for renabada
Member Avatar for Jasper11

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.

Member Avatar for Jasper11
0
8K
Member Avatar for IU34
Member Avatar for aot

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 …

Member Avatar for woooee
0
235
Member Avatar for aot

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 …

Member Avatar for ZZucker
0
149
Member Avatar for rt7878
Member Avatar for fengle1

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 …

Member Avatar for sneekula
0
109
Member Avatar for hudson5cp

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, # …

Member Avatar for hudson5cp
0
754
Member Avatar for erezlevi

That sort of thing is usually done by subprocess.Popen() or os.popen() functions.

Member Avatar for sneekula
0
96
Member Avatar for The Dude

Somebody forgot the corkscrew and for several days we had to live on nothing but food and water. -- WC Fields

Member Avatar for jwenting
0
139
Member Avatar for Ramy Mahrous

[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.

Member Avatar for DimaYasny
0
289
Member Avatar for The Dude
Member Avatar for The Dude

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.

Member Avatar for The Dude
0
113
Member Avatar for majestic0110
Member Avatar for jbennet
0
164
Member Avatar for The Dude
Member Avatar for ZZucker
0
60
Member Avatar for rysin

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 //= …

Member Avatar for Ene Uran
0
110
Member Avatar for Google Spider
Member Avatar for sneekula
0
218
Member Avatar for strictlycustom

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, …

Member Avatar for vegaseat
0
95
Member Avatar for nish88

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 …

Member Avatar for nish88
0
125
Member Avatar for Ancient Dragon

The other question should be: "Who of the richest folks pays the most tax?"

Member Avatar for vegaseat
0
249
Member Avatar for AralX
Member Avatar for mcenley

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 …

Member Avatar for mcenley
0
121
Member Avatar for The Dude

Ah, the home shopping channels. They are proof for the old saying that a fool and his/her money are soon parted.

Member Avatar for bumsfeld
0
120
Member Avatar for bumsfeld

[QUOTE=~s.o.s~;556126]Something one can wear on his hand and use it to rip out someones' intestines.[/QUOTE]A surgical tool?

Member Avatar for bumsfeld
0
85
Member Avatar for Zelores

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 …

Member Avatar for Zelores
0
197
Member Avatar for fonz87

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 …

Member Avatar for jrcagle
0
120
Member Avatar for techno t

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.

Member Avatar for jbennet
0
102
Member Avatar for sneekula

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.

Member Avatar for reddawg
0
1K
Member Avatar for Ramy Mahrous
Member Avatar for jbennet
0
126
Member Avatar for Pilate

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).

Member Avatar for sneekula
0
188
Member Avatar for linux

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!

Member Avatar for linux
0
132
Member Avatar for nxavier

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 …

Member Avatar for nxavier
0
89
Member Avatar for sneekula

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 …

Member Avatar for GrimJack
0
677
Member Avatar for sneekula

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 …

Member Avatar for GrimJack
0
504
Member Avatar for Dave Sinkula
Member Avatar for sneekula
Member Avatar for bumsfeld
0
267
Member Avatar for zandiago

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 …

Member Avatar for jwenting
0
133
Member Avatar for scru

[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.

Member Avatar for Infarction
0
113

The End.