[Tutor] how to retrieve values from scale widget(sample code is attached)????

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Sun, 18 Mar 2001 05:50:07 -0800 (PST)


On Fri, 16 Mar 2001, Charles Gruschow wrote:

> I can figure out frames and the basic widget formats themselves, but I can't 
> figure out how to retrieve data from this widget so I can use it as input 
> data in some other part of a program.

Dear Charles,

Sorry for the long delay!  Try to use the get() method of your scale
widget, and you should be able to read off its value.  Here's a sample bit
of code that shows how to do this.

###
from Tkinter import *

s = Scale()
s.pack(side=TOP)
def reportScaleValue(scale = s):
    print s.get()
b = Button(text="Press me!", command=reportScaleValue)
b.pack(side=TOP)
mainloop()
###

Good luck!