Advertisement
furas

Python - Tkinter - Checkbutton

Jun 10th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import tkinter as tk
  2.  
  3. def func(text):
  4.     print(text)
  5.  
  6. root = tk.Tk()
  7.  
  8. cb1 = tk.Checkbutton(root, text="Hello", command=lambda:func("hello"))
  9. cb1.pack()
  10.  
  11. cb2 = tk.Checkbutton(root)
  12. cb2.pack()
  13.  
  14. l = tk.Label(root, text="World")
  15. l.pack()
  16.  
  17. l.bind('<Button-1>', lambda event:cb2.invoke())
  18.  
  19. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement