Hi - I'm trying to figure out why the Tkinter Scale widget seems to fire its command callback when the root.mainloop() is executed. This seems in contrast with other widgets like the Button that only fire the command callback in response to user interaction. I'm using Windows XP, the Python 2.5 and, based on the folder names in the Python\tcl folder, tk8.4 and tcl8.4.
Below is an example script. It sets up two sliders who get values initialized in two different ways. The print statements show that the sliders are initialized and packed, and THEN the command callbacks occur once the root.mainloop() statement executes. Can suggest a way to prevent this from happening? I could have each callback do no action the first time it is called, I suppose. But I wonder if I'm simply doing something wrong, or if I'm assuming a behavior from Tkinter that I should not, or if I've encountered something "strange". Thanks in advance! Dave Giesen # Start of demo script import Tkinter as Tk import gwidgets as gw root = Tk.Tk() def printme1(value): print 'Scale # 1 just called back with value:', value scalevar = gw.iVar(7) scale1 = Tk.Scale(root, command=printme1, variable=scalevar) print 'Scale #1 initialized with value:', scale1.get() def printme2(value): print 'Scale # 2 just called back with value:', value scale2 = Tk.Scale(root) print 'Scale #2 initialized with value: ', scale2.get() scale2.set(4) print 'Scale #2 just set to value: ', scale2.get() scale2.configure(command=printme2) print 'Now packing scales' scale1.pack() scale2.pack() print 'Done packing scales' root.mainloop() # End of demo script _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss