Advertisement
Guest User

Untitled

a guest
Jun 29th, 2022
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. # Виджет CheckButton (флажок)
  2.  
  3. def selectAll():
  4.     for check in [switch1, switch2, switch3]:
  5.         check.select()
  6.        
  7. def deselectAll():
  8.     for check in [switch1, switch2, switch3]:
  9.         check.deselect()
  10.        
  11. def toggleAll():
  12.     for check in [switch1, switch2, switch3]:
  13.         check.toggle()    
  14.      
  15. import tkinter as tk
  16. win = tk.Tk()
  17. win.title('Мое графическое приложение')
  18. win.geometry('600x300+600+350')
  19.  
  20. switch1 = tk.Checkbutton(win, text = 'Включить микрофон')
  21. switch1.pack()
  22.  
  23. switch2 = tk.Checkbutton(win, text = 'Отключить рекламу')
  24. switch2.pack()
  25.  
  26. switch3 = tk.Checkbutton(win, text = 'Подписаться на канал', indicatoron = 0)
  27. switch3.pack()
  28.  
  29. tk.Button(win, text = 'Выбрать всё', command = selectAll).pack()
  30. tk.Button(win, text = 'Отменить всё', command = deselectAll).pack()
  31. tk.Button(win, text = 'Переключатель', command = toggleAll).pack()
  32.  
  33.  
  34. win.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement