[Tkinter] Checkboxes in different frames misbehave - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [Tkinter] Checkboxes in different frames misbehave (/thread-13047.html) |
Checkboxes in different frames misbehave - octoeder - Sep-25-2018 import tkinter as tk root = tk.Tk() Frame1 = tk.Frame(root) Frame2 = tk.Frame(root) Frame1.pack() Frame2.pack() tk.Checkbutton(Frame1, text="checkbutton #1").pack() tk.Checkbutton(Frame2, text="checkbutton #2").pack() root.mainloop()Why does it check both checkbuttons if I click only one and how can I make them independent without putting both in the same frame? RE: Checkboxes in different frames misbehave - woooee - Sep-25-2018 Checkbuttons have an associated IntVar which controls them. A simple search will turn up lots of beginner examples. RE: Checkboxes in different frames misbehave - Larz60+ - Sep-26-2018 good writeup here: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/checkbutton.html this manual is also available for everything tkinter as a PDF and html format here: web RE: Checkboxes in different frames misbehave - jfong - Oct-03-2018 (Sep-25-2018, 03:32 PM)octoeder Wrote:import tkinter as tk root = tk.Tk() Frame1 = tk.Frame(root) Frame2 = tk.Frame(root) Frame1.pack() Frame2.pack() tk.Checkbutton(Frame1, text="checkbutton #1").pack() tk.Checkbutton(Frame2, text="checkbutton #2").pack() root.mainloop()Why does it check both checkbuttons if I click only one and how can I make them independent without putting both in the same frame? There are two independent frames and checkbuttons. You can see it simply by modifying: Frame1 = tk.Frame(root, bg='red', padx=10) And in my test, I didn't see both checkbuttons can be checked by a single click. |