So, here is the code I have, and as I run it, the value of the slider bar appears above the slider, I wonder is there a way to get that value out? Maybe let a=that value. ;)
from Tkinter import *control = Tk()
control.geometry("350x200+100+50")scale = Scale(control,orient=HORIZONTAL,length=300,width=20,sliderlength=10,from_=0,to=1000,tickinterval=100)
scale.pack()control.mainloop()
To get the value as it is modified, associate a function with the parameter command
. This function will receive the current value, so you just work with it. Also note that in your code you have cline3 = Scale(...).pack()
. cline3
is always None in this case, since that is what pack()
returns.
import Tkinterdef print_value(val):print valroot = Tkinter.Tk()scale = Tkinter.Scale(orient='horizontal', from_=0, to=128, command=print_value)
scale.pack()root.mainloop()