Scale Demo : Scale : GUI Tk PYTHON examples


PYTHON examples » GUI Tk » Scale »

 

Scale Demo


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(0300))
    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()
           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo GUI Tk
» Scale