tk6_scale.py 643 B

12345678910111213141516171819202122
  1. # View more python learning tutorial on my Youtube and Youku channel!!!
  2. # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
  3. # Youku video tutorial: http://i.youku.com/pythontutorial
  4. import tkinter as tk
  5. window = tk.Tk()
  6. window.title('my window')
  7. window.geometry('200x200')
  8. l = tk.Label(window, bg='yellow', width=20, text='empty')
  9. l.pack()
  10. def print_selection(v):
  11. l.config(text='you have selected ' + v)
  12. s = tk.Scale(window, label='try me', from_=5, to=11, orient=tk.HORIZONTAL,
  13. length=200, showvalue=0, tickinterval=2, resolution=0.01, command=print_selection)
  14. s.pack()
  15. window.mainloop()