ScottA opened this issue on Feb 25, 2001 ยท 39 posts
jcarp posted Thu, 22 March 2001 at 5:22 PM
You can use the callback (command = ...) option on the Tk scale to get a notification that the scale value has changed. Example below. NOTE: the callback has to expect an argument when it's called: a string representing the new value of the scale. This useful piece of info is missing from the current Tkinter docs and buried in Grayson's very nice book, but it's in the Tk/Tcl manual. There are just some spots with Tkinter where you have to go that far. Regards,
from Tkinter import *
def report(value):
print 'value received %s' % value
def TestScale():
root = Tk()
s = Scale(root, orient = HORIZONTAL, from_ = 0, to = 255, command = report)
s.set(100)
s.pack()
root.protocol("WM_DELETE_WINDOW",root.quit)
root.mainloop()
root.destroy()