Update Label when Scale value changes

Discussion in 'Python' started by codecraig, Apr 19, 2005.

  1. codecraig

    codecraig Guest

    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.
    codecraig, Apr 19, 2005
    #1
    1. Advertising

  2. codecraig wrote:

    > 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?=, Apr 19, 2005
    #2
    1. Advertising

  3. codecraig

    codecraig Guest

    codecraig, Apr 19, 2005
    #3
  4. =?ISO-8859-1?Q?J=F8rgen_Cederberg?=, Apr 19, 2005
    #4
  5. codecraig

    Kent Johnson Guest

    Kent Johnson, Apr 19, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dev S Shrestha
    Replies:
    1
    Views:
    695
    Thomas Matthews
    Nov 11, 2003
  2. Casey Hawthorne
    Replies:
    0
    Views:
    336
    Casey Hawthorne
    Oct 17, 2005
  3. crjunk
    Replies:
    3
    Views:
    430
    crjunk
    Oct 31, 2008
  4. ActiveX .NET cannot update label's Text value?

    , Aug 4, 2006, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    143
  5. Knut Krueger
    Replies:
    8
    Views:
    253
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page