Re: [Tutor] list of instance objects, access attribute

2009-06-19 Thread Vincent Davis
Thanks to all for the comments, It was much more than I expected. Vincent On Fri, Jun 19, 2009 at 4:30 PM, Lie Ryan wrote: > Alan Gauld wrote: >> >> "Vincent Davis" wrote >> >> class B(): >>  def __init__(self, b1, b2): >>     self.fooa = b1 >>     self.foob = b2 >> >> I assume thats what you r

Re: [Tutor] how to manage an encrypted file?

2009-06-19 Thread Chris Fuller
On Friday 19 June 2009 17:23, Robert Lummis wrote: > Could you recommend a module or methods I should use to manage an > encrypted text file? I want to store passwords and associated contact > information in a file and feel confident that if the file is stolen > the information couldn't be read. U

Re: [Tutor] Need help with code.

2009-06-19 Thread Dave Angel
Raj Medhekar wrote: Hi, I need help with the code below. I am trying to pair the list in the hint with the list of words. However, the list is not matching up correctly. Also when the correct guess is entered the program just continues without acknowledging the right answer. Please could y'al

Re: [Tutor] Need help with code.

2009-06-19 Thread bob gailer
Raj Medhekar wrote: Hi, I need help with the code below. I am trying to pair the list in the hint with the list of words. However, the list is not matching up correctly. Also when the correct guess is entered the program just continues without acknowledging the right answer. Please could y'all

[Tutor] how to manage an encrypted file?

2009-06-19 Thread Robert Lummis
Could you recommend a module or methods I should use to manage an encrypted text file? I want to store passwords and associated contact information in a file and feel confident that if the file is stolen the information couldn't be read. -- Robert Lummis __

Re: [Tutor] list of instance objects, access attribute

2009-06-19 Thread Lie Ryan
Alan Gauld wrote: > > "Vincent Davis" wrote > > class B(): > def __init__(self, b1, b2): > self.fooa = b1 > self.foob = b2 > > I assume thats what you really meant! > > Ok now I have several instances in a list > b1 = B(1, 2) > b2 = B(3, 4) > b3 = B(9, 10) > alist = [b1, b2, b3] > >>

Re: [Tutor] Tkinter idiosyncracies?

2009-06-19 Thread Lie Ryan
Wayne wrote: > I'd expect that upon clicking the button the text of the label would > change to 'Foo', then it would wait for 4 seconds, and then the text > would change to 'Bar'. It doesn't do this - instead, it waits for 4 > seconds, and then the text changes to foo, then bar, almost too fast to

Re: [Tutor] Tkinter idiosyncracies?

2009-06-19 Thread Alan Gauld
"Wayne" wrote Am I missing something essential here? Or is this a bug that nobody has encountered yet? Its not a bug its the way GUIs and event driven programs work. You need to buuld the time delay as an event so the after() approach is nearly right. But you need the first event to make

[Tutor] Tkinter idiosyncracies?

2009-06-19 Thread Wayne
Hi, I'm having some problems with Tkinter doing its own thing (or not) when I try to time events. for instance: import time import Tkinter as tk def funky(): lbl.config(text='Foo') time.sleep(4) lbl.config(text='Bar') root = tk.Tk() lbl = tk.Label(text = "Click the button to see weirdness") bt

[Tutor] Need help with code.

2009-06-19 Thread Raj Medhekar
Hi, I need help with the code below. I am trying to pair the list in the hint with the list of words. However, the list is not matching up correctly. Also when the correct guess is entered the program just continues without acknowledging the right answer. Please could y'all test this out and let

Re: [Tutor] [pygtk] taking image of gtk.drawing area

2009-06-19 Thread saeed
JPEG doesn't support alpha (transparency), try with PNG or GIF. On 6/19/09, Amit Sethi wrote: > Hi , > I am trying to take image of a gst video playing in the gtk.drawingarea i am > using following code for it : > > def snap_shot(self,widget,data=None): > global file_loc ,pixbuf >

Re: [Tutor] Handling Generator exceptions in Python 2.5

2009-06-19 Thread Dave Angel
Joe Python wrote: I have a generator as follows to do list calculations. *result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))]* The above generator, throws '*ZeroDivisionError*' exception if ListA[i] = 0. Is there a way to say 'Don't divide by ListA[i] if its equal to 0 (wi

Re: [Tutor] Handling Generator exceptions in Python 2.5

2009-06-19 Thread Alan Gauld
"Joe Python" wrote *result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))]* The above generator, throws '*ZeroDivisionError*' exception if ListA[i] = 0. Is there a way to say 'Don't divide by ListA[i] if its equal to 0 (within that statement)'. You could use an 'or' sidef

Re: [Tutor] Handling Generator exceptions in Python 2.5

2009-06-19 Thread Joe Python
Thanks everyone for the responses. - Joe On Fri, Jun 19, 2009 at 11:09 AM, vince spicer wrote: > Well* > > *result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))*if > not ListA[i] == 0*] > > will exclude any results where listA[i] is 0, if you still want these in > the result >

Re: [Tutor] Handling Generator exceptions in Python 2.5

2009-06-19 Thread vince spicer
Well* *result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))*if not ListA[i] == 0*] will exclude any results where listA[i] is 0, if you still want these in the result you may want to use good'ol for statement instead of list comprehension results = [] for x in range(len(listA))

[Tutor] Handling Generator exceptions in Python 2.5

2009-06-19 Thread Joe Python
I have a generator as follows to do list calculations. *result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))]* The above generator, throws '*ZeroDivisionError*' exception if ListA[i] = 0. Is there a way to say 'Don't divide by ListA[i] if its equal to 0 (within that statement)'.

[Tutor] Python and SQL recommendation

2009-06-19 Thread Timo List
Hello all, At the moment I'm using 3 files as datastorage for my program. One file using ConfigParser and two use the Pickle module. File one contains for example: [ID] option1 = string1 option2 = string2 option3 = string3 And is connected to one of the Pickle files which is like this: {ID : [{k

Re: [Tutor] converting encoded symbols from rss feed?

2009-06-19 Thread Serdar Tumgoren
> OK, so newline is unicode, outfile.write() wants a plain string. What > encoding do you want outfile to be in? Try something like > outfile.write(newline.encode('utf-8')) > or use the codecs module to create an output that knows how to encode. Aha!! The second of the two options above did the tr

[Tutor] taking image of gtk.drawing area

2009-06-19 Thread Amit Sethi
Hi , I am trying to take image of a gst video playing in the gtk.drawingarea i am using following code for it : def snap_shot(self,widget,data=None): global file_loc ,pixbuf self.pipeline.set_state(gst.STATE_PAUSED) pixbuf = gtk.gdk.Pixbuf( gtk.gdk.COLORSPACE_RGB, False,

Re: [Tutor] distutils archive creation blocked

2009-06-19 Thread spir
Solved -- actually it was an error of mine in a wrapping subprocess.Popen() call. Le Fri, 19 Jun 2009 10:58:02 +0200, spir s'exprima ainsi: > Hello, > > when trying to create an archive with > >python setup.py sdist --formats=gztar,zip > > all works fine (archives are created) except tem

[Tutor] distutils archive creation blocked

2009-06-19 Thread spir
Hello, when trying to create an archive with python setup.py sdist --formats=gztar,zip all works fine (archives are created) except temp dir deletion. Program blocks on removing 'foobar-1.0' (and everything under it) Actually, don't know how to check further for don't where this temp di

Re: [Tutor] home directory usage script

2009-06-19 Thread Alan Gauld
"dave chachi" wrote create a python that will accomplish the following tasks: issue: /home partition is partitioned to 80 or so G of space 24 G's is used A. What is taking up this amount of space B. Not alot of packages are installed and shouldnt take up much space While a Python script

Re: [Tutor] list of instance objects, access attribute

2009-06-19 Thread Alan Gauld
"Vincent Davis" wrote class B(): def __init__(self, b1, b2): self.fooa = b1 self.foob = b2 I assume thats what you really meant! Ok now I have several instances in a list b1 = B(1, 2) b2 = B(3, 4) b3 = B(9, 10) alist = [b1, b2, b3] Lets say for each instance of the class I want to