Scale Demo: random choice : Scale « GUI Tk « Python






Scale Demo: random choice

Scale Demo: random choice

from Tkinter import *
import random
root = Tk()

class Indicator:
    def __init__(self, master=None, label='', value=0.0):
  self.var = DoubleVar()
  self.s = Scale(master, 
                 label=label, 
                 variable=self.var,
               from_=0.0, 
               to=300.0, 
               orient=HORIZONTAL,
               length=300)
  self.var.set(value)
  self.s.pack()
  
def setTemp():
    slider = random.choice(range(10))
    value  = random.choice(range(0, 300))
    slist[slider].var.set(value)
    root.after(5, setTemp)
    
slist = []
for i in range(5):
    slist.append(Indicator(root, label='Probe %d' % (i+1)))

setTemp()
root.mainloop()
           
       








Related examples in the same category

1.Use Scale
2.Bound Scale action with a canvasBound Scale action with a canvas
3.Scale widgetScale widget
4.Scale Demo: get scale value and open different dialogsScale Demo: get scale value and open different dialogs
5.Scale: get Scale valueScale: get Scale value
6.Scale used to control the size of a circleScale used to control the size of a circle
7.Canvas paint: controlled by ScaleCanvas paint: controlled by Scale