Update Label when Scale value changes

C

codecraig

Hi,
I am using Tkinter and I have a Label and a Scale. I want to update
my label everytime the Scale value changes. What is the best way of
doing this? Do i have to bind for every event type? Or is there some
better way? If I do have to bind each type of event to the scale, what
types occur for a Scale?

Thanks.
 
?

=?ISO-8859-1?Q?J=F8rgen_Cederberg?=

codecraig said:
Hi,
I am using Tkinter and I have a Label and a Scale. I want to update
my label everytime the Scale value changes. What is the best way of
doing this? Do i have to bind for every event type? Or is there some
better way? If I do have to bind each type of event to the scale, what
types occur for a Scale?

Thanks.

Hi

you could use a variable. Below is simple program that connects the value of the scale to
the label.


from Tkinter import *

root = Tk()

var = IntVar()
Label(root, textvariable=var).pack()
Scale(root, from_=-2.0, to=10.0, variable=var).pack()

root.mainloop()

Hope this helps
Jorgen Cederberg
 
?

=?ISO-8859-1?Q?J=F8rgen_Cederberg?=

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top