Jorge Louis De Castro napsal(a):
This art is called Trace Variable and could be used like this (copied and rearranged from one of the prevously posted message from here): from Tkinter import * OPTIONS = [ "egg", "bunny", "chicken" ] def callbackFunc(name, index, mode): #print "callback called with name=%r, index=%r, mode=%r" % (name, index, mode) varValue = root.getvar(name) print varValue # modify the value, just to show it can be done #root.setvar(name, varValue) root = Tk() var = StringVar() var.set(OPTIONS[2]) # default value rememberMe = var.trace_variable('w', callbackFunc) # var.trace('w', callbackFunc) # this works, too w = OptionMenu (root, var, *OPTIONS) w.pack() root.mainloop() Hope its what you asked for :-) -- geon |
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
