Tkinter events - how to make a "change" event?

Greg McFarlane gregm at iname.com
Mon Mar 6 08:13:38 EST 2000


It looks like you may be doing this:
    combobox.bind('<blah>', blah)
when you probably should be doing this:
    combobox.component('entry').bind('<blah>', blah)
The former puts the binding on the megawidget's hull component (the
containing frame).

But you really should be using the modifiedcommand option of the
combobox's entry component:
    combobox = Pmw.ComboBox(...
	    entry_modifiedcommand = myCallbackFunction,
	    ...)

>From the Pmw.EntryField manual page:
    modifiedcommand
	This is called whenever the contents of the entry has been
	changed due to user action or by a call to setentry().


On 1 Mar, Thomas Lane wrote:
> I'm using a Pmw.ComboBox and I want to handle a "change" event for the
> text field. First of all, callbacks bound to a Pmw.ComboBox don't seem
> to work. I can bind them, but the functions never get called. Does
> anyone know why? Second, from what I've read, it looks like Tkinter only
> supports mouse and keyboard events, so there is no such thing as a
> "change" event. What is the best way to implement something like this?
> Should I just catch every mouse and keyboard event for the object and
> check for a change every time? Any help would be appreciated.
> 
> -Tom
> tom at parlant.com
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 

-- 
Greg McFarlane     INMS Telstra Australia     gregm at iname.com




More information about the Python-list mailing list