Using bound variables in Tkinter events
newsgroups at jhrothjr.com
Wed Mar 31 18:29:23 CEST 2004
"Derek Fountain" <devnull at example.com> wrote in message
news:4067a227$0$16577$5a62ac22 at freenews.iinet.net.au...
> I'm coming to Tkinter from Tcl/Tk. In Tcl I can get a variable in an event
> using the %<X> substitution mechanism. For example, I can set up a command
> entry .e -validate 1 -vcmd "checkkey %d"
> knowing that the '%d' will be replaced by something useful - whether the
> entry widget has recieved an insert or deletion in this case. The checkkey
> procedure will recieve "insert", "delete" or whatever as its first
> What is the Tkinter way of getting that %d value?
It's in the event object that's passed as the (only) parameter
to your event handler. Everything you ever wanted to know
about the event is an attribute.
There are a number of very good references to Tkinter on
the first page of the Python Library Reference section on
Tkinter. (That's section 16 in the Python 2.3 reference)
More information about the Python-list