[Tutor] Event handler for optionmenu

Jorge Louis De Castro jorge at bcs.org.uk
Mon Aug 15 11:18:26 CEST 2005


I have an optionmenu widget that works just fine except that  can't find docs to get hold of events as they happen, kinda like the command=XYZ of other widgets like buttons.

The code I'm using for the option menu is the following:

OPTIONS = ["en","pt","es","it","fr","de"]
self.startw.variable = StringVar()
self.startw.variable.set(OPTIONS[0]) # default value
self.startw.whis_butt=apply(OptionMenu, (self.startw, self.startw.variable) + tuple(OPTIONS))
self.startw.whis_butt.grid(column=1, row=3)

Now I'd like to have a function like:

def onChange(self):
     # do optionmenu specific stuff

but can't find how to do it, how to associate/bind onChange with the optionmenu widget.
Any help will be highly appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050815/16d94665/attachment.htm

More information about the Tutor mailing list