Re: [Tutor] Else Clause In A Loop

2008-05-13 Thread kinuthia muchane
On Tue, 2008-05-13 at 11:09 -0400, "Simón A. Ruiz" wrote: > kinuthia muchane wrote: > > On Mon, 2008-05-12 at 14:08 -0400, "Simón A. Ruiz" wrote: > >> For each of those numbers, it checks to see if any number between 2 and > >> i is divisible into i. If it finds anything, we know it's not a prime

Re: [Tutor] (no subject)

2008-05-13 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Tue, May 13, 2008 at 8:34 PM, <[EMAIL PROTECTED]> wrote: hey guys i was wondering if there was a way for me to destroy a window that is playing a movie,. once the movie is finished Perhaps. Would you care to gi

[Tutor] destroying a window once a movie has stoped playing

2008-05-13 Thread Nick.Treloar
def movieu(self): mov_name = "video.mpg" pygame.mixer.quit() screen = pygame.display.set_mode((320, 240)) video = pygame.movie.Movie(mov_name) screen = pygame.display.set_mode(video.get_size()) video.play() while video.get_busy():

Re: [Tutor] (no subject)

2008-05-13 Thread Kent Johnson
On Tue, May 13, 2008 at 8:34 PM, <[EMAIL PROTECTED]> wrote: > > > hey guys i was wondering if there was a way for me to destroy a window that > is playing a movie,. once the movie is finished Perhaps. Would you care to give some more details? Perhaps some code? Kent _

[Tutor] Sorting Dictionary Keys

2008-05-13 Thread FT
Jim, OK, use the example below for sorting dictionary keys and placing them in a list. Note that an error will happen if the format on the print statement does not correspond to the type of sort. #THIS SORTS A DICTIONARY BY USING SET THEORY AND DIC ITEMS! import random dic = {} print "Randomizi

[Tutor] (no subject)

2008-05-13 Thread Nick.Treloar
hey guys i was wondering if there was a way for me to destroy a window that is playing a movie,. once the movie is finished This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not

Re: [Tutor] Memory Leak?

2008-05-13 Thread Keith Suda-Cederquist
Sorry for not responding sooner. I took the advice to add these two lines to my code: import matplotlib matplotlib.use('Agg') -Keith Jeff Younker <[EMAIL PROTECTED]> wrote: > I followed the advice on this page: http://mail.python.org/pipermail/python-list/2006-December/417208.html > and the

Re: [Tutor] pyUSB linux + unknown device

2008-05-13 Thread Michael Langford
This should get you started. You're need to go to figure out your data format, and you're going to need to go through the data, most likely with a snooper. http://www.nabble.com/Using-pyusb-td16164343.html --Michael On Mon, May 12, 2008 at 8:03 PM, Downbound <[EMAIL PROTECTED]> wrote: >

Re: [Tutor] How to make a python binding for a c library?

2008-05-13 Thread Alan Gauld
"tuyun" <[EMAIL PROTECTED]> wrote I have a library written in C, I want to make a python binding for it. If on Windows and a DLL then ctypes is probably the best bet. If a simple object file on *nix then you might try SWIG, the basic tutorial there is quite good. There are lots of HowTo

Re: [Tutor] How to make a python binding for a c library?

2008-05-13 Thread Andreas Kostyrka
Am Montag, den 12.05.2008, 23:31 -0700 schrieb Mark Tolonen: > "tuyun" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi > > I have a library written in C, I want to make a python binding for it. > > But I dont know how to get started. > > Is there any guide or document? > > Is

Re: [Tutor] Else Clause In A Loop

2008-05-13 Thread Simón A. Ruiz
kinuthia muchane wrote: On Mon, 2008-05-12 at 14:08 -0400, "Simón A. Ruiz" wrote: For each of those numbers, it checks to see if any number between 2 and i is divisible into i. If it finds anything, we know it's not a prime, and so it breaks out of that second loop without completing it, which

Re: [Tutor] sorting dictionary keys?

2008-05-13 Thread Kent Johnson
On Tue, May 13, 2008 at 7:58 AM, Norman Khine <[EMAIL PROTECTED]> wrote: > how about this > > > >>> d = { 'a' : 1, 'd' : 2, 'b' : 3, 'c' : 0 } > >>> for i in sorted(set(d)): > ... print "%s\t%s" % (i, d[i]) The set() is not needed. Also to iterate over key, value pairs in order by key you

Re: [Tutor] sorting dictionary keys?

2008-05-13 Thread Kent Johnson
On Tue, May 13, 2008 at 7:32 AM, Mugund K <[EMAIL PROTECTED]> wrote: > > A quick but ugly [brain-dead :-) ]fix would be sorting keys seperately, > >>> temp = d.keys() > >>> temp.sort() > >>> for i in temp: Not so ugly; before sorted() was introduced (Python 2.4) that would be the way to do it. K

Re: [Tutor] sorting dictionary keys?

2008-05-13 Thread Norman Khine
how about this >>> d = { 'a' : 1, 'd' : 2, 'b' : 3, 'c' : 0 } >>> for i in sorted(set(d)): ... print "%s\t%s" % (i, d[i]) ... a 1 b 3 c 0 d 2 James Hartley wrote: I suspect this is a brain-dead question... Given the following code, output is as expected: $ cat te

Re: [Tutor] sorting dictionary keys?

2008-05-13 Thread Kent Johnson
On Tue, May 13, 2008 at 7:06 AM, James Hartley <[EMAIL PROTECTED]> wrote: > But if the keys are sorted, I get an error: > $ cat test1.py > d = { 'a' : 1, 'd' : 2, 'b' : 3, 'c' : 0 } > > for i in d.keys().sort(): > print "%s\t%s" % (i, d[i]) > $ python test1.py > Traceback (most recent ca

Re: [Tutor] sorting dictionary keys?

2008-05-13 Thread Mugund K
A quick but ugly [brain-dead :-) ]fix would be sorting keys seperately,   >>> for i in d.keys(): print "%s\t%s" % (i, d[i])    a 1c 0b 3d 2>>> temp = d.keys()>>> temp.sort()>>> for i in temp: print "%s\t%s" % (i, d[i])    a 1b 3c 0d 2>>>   Thnx, Mugund--- On Tue, 5/13/08, James Hartley <[EMAIL PR

[Tutor] sorting dictionary keys?

2008-05-13 Thread James Hartley
I suspect this is a brain-dead question... Given the following code, output is as expected: $ cat test.py d = { 'a' : 1, 'd' : 2, 'b' : 3, 'c' : 0 } for i in d.keys(): print "%s\t%s" % (i, d[i]) $ python test.py a 1 c 0 b 3 d 2 $ But if the keys are sorted, I get an