pass an event up to parent widget

William Gill noreply at gcgroup.net
Thu Jun 23 18:44:55 CEST 2005


I have a Tkinter (frame) widget that contains several other frame 
widgets, each containing entry widgets.  In the parent frame I have a 
'save' button that is initially disabled.  As it is now, each widget has 
a hasChanged property that I can poll to see if updates to the source 
data need to be made.  hasChanged is set to True by an event routine in 
each frame widget, and this works fine for my exit routine which knows 
to poll each widget for hasChanged.  What I don't know how to do is send 
an event up the chain to the top so it can change the 'save' button to 
NORMAL (telling the user 'The data has been changed and can be saved if 
wanted') .  I don’t think bind_class() to all entry widgets is the way 
to go.  I could create an after() alarm callback to poll hasChanged, but 
again this seems to awkward.  I have looked at widget.event_add() but, 
don't know if this is viable. I am thinking a virtual event without any 
SEQUENCE, and then triggering it programmatically (from within the 
sub-widget event handlers).  Is that doable? Isn't there a better way?


Any suggestions?


Bill



More information about the Python-list mailing list