tkinter question
Bob van der Poel
bvdpoel at uniserve.com
Mon Jun 12 16:37:34 EDT 2000
I'm trying to set up a few simple things using tkinter and have run into
a couple of roadblocks...probably because I'm new to python, don't have
a good reference to tkinter...
First, I'd like to have a function which saves some of it's own data
(privately). I tried to do this with a class, but essentially run into
the same problem with a function or a class. I've ended up doing
something like this:
def myfunc( stats=[] ):
if len( stats ) > 0:
.. do already 'done'
else:
do first time...
stats.append("done")
Okay, this works. Is this a good way to handle this situation?
Second, if I try to append to stats with something like:
stats.append ( Toplevel() )
I get an error. So I end up with:
w = Toplevel()
stats.append(w)
which works. I have no idea why the first doesn't.
Third, how can I define a widget command with an arg. For example:
q = Button( text="Quit", command = quitit("sure?") )
Of course,
q = Button( text = "Quit", command = quitit )
works fine.
Thanks!
--
__
/ ) / Bob van der Poel
/--< ____/__ bvdpoel at uniserve.com
/___/_(_) /_) http://users.uniserve.com/~bvdpoel
More information about the Python-list
mailing list