Using bound variables in Tkinter events

Derek Fountain devnull at
Thu Apr 1 04:03:38 CEST 2004

wes weston wrote:

> Derek Fountain wrote:
>> 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 like:
>>  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 parameter.
>> What is the Tkinter way of getting that %d value?
> Derek,
> f = Entry()
> ...
> v = StringVar()
> v.set("test")
> f["textvariable"] = v
> print v.get()

Thanks, but that's not what I was after! I want to know the type of action
I've received - the %d binding for the validatecommand.

More information about the Python-list mailing list