Simple Gui for Data entry...

Will Stuyvesant hwlgw at hotmail.com
Fri Dec 13 02:53:02 EST 2002


I dont know about PMW but a good way to bind variables to widgets in
Tkinter is using a Tkinter variable: like ``IntVar``, ``StringVar``.

Typically something like::

 var = IntVar()
 value = 10
 ... here btn = Button(blahblah) ...
 btn.bind('Say Hello', lambda event, b=btn, v=var, i=value:
     (b.flash(), v.set(i)))

if you dont like lambda you have to write a function::

 def btnAction(event, b, v, i):
     b.flash()
     v.set(i)

and do::

 btn.bind('Say Hello', btnAction)

Note this is off the top of my head so um...look in your Tkinter docs
for really working examples with IntVar etc.



More information about the Python-list mailing list