Python Forum
[Tkinter] Checkbutton clicks events does not update visually.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Checkbutton clicks events does not update visually.
#1
Question 
Tl;dr: How (Where can I get information) do we troubleshoot Tkinter at this system presentation layer? Surely the maintainers of Tkinter would have documented a guide somewhere.

The Tkinter Checkbutton widget does not update, when clicking on the checkbox, on this specific Kubuntu (KDE Plasma 5.18) machine configuration.
This issue did not occur on Windows 8.1, [VBox]LiveCD Kubuntu 20.04 (Plasma 5.18), [VBox]LiveCD Kubuntu 20.10 (Plasma 5.19), Kubuntu 20.04 (XFCE [Same machine]).
Tests with other GUI frameworks (Kivy, GTK, wxPython, Qt) works correctly.

Search results does not really provide guides or issues related to this specific.
My next move is to also ask advice on the python.org discuss platform.

[Image: 102712370-6f69da80-42c9-11eb-864b-ec822072f94c.gif]

from tkinter import *
class MyGUI:
    def __init__(self, window):
        self.var = IntVar()
        self.c = Checkbutton(window,
                             text="Enable Tab",
                             variable=self.var,
                             command=self.cb)
        self.c.pack()

    def cb(self):
        print("self.var is", self.var.get())

if __name__ == "__main__":
    root = Tk()
    gui = MyGUI(root)
    root.mainloop()
Output:
self.var is 1 self.var is 0 self.var is 1 self.var is 0 self.var is 1 self.var is 0
SYSTEM SPECS:
Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.4.0-58-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i3 CPU M 350 @ 2.27GHz
Memory: 7,6 GiB of RAM

Python 3.8.5
Tcl/Tk version 8.6
Reply
#2
ANSWER, SOLUTION, and CONCLUSION

The root cause is the "*Window Text*" colour of the "*KDE Plasma Color Schemes*" that are "*Breeze Dark*" related result in the Tkinter Checkbutton not being 100% visible due to the text colour being so similar to the checkbox background.

[Image: 102718457-db136e00-42f0-11eb-9403-bc2eb55fb8d8.png]

SOLUTION / WORKAROUND
It is recommended to consider styling(themes) when building application GUI's to improve the user's experience by enabling them to change the GUI to some extend. In this case, it would seem Tkinter is using a system setting value intended for an other purpose.

The quickest workaround is to import the tkinter.ttk (Python3) at very least.


    
from tkinter import *
from tkinter.ttk import *
[Image: 102718554-71e02a80-42f1-11eb-939c-b5cd325b76c7.png]

CONCLUSION
This will get updated as more information becomes available I guess.
With the issue above, the problem is luckily relatively simple and should be part of a bug confirmation checklist. However, debugging is a lot more complex, vague, or a dark art. Below are some directions to support troubleshooting and investigating Tkinter related issues.

1. Since Tkinter is a wrapper for the Tcl/tk interpreter, things get tricky. The Tkinter source can be located on [GitHub](https://github.com/python/cpython/blob/m..._tkinter.c).
2. Seems like the starting point is to work through the [Tcl Developer Xchange](http://www.tcl-lang.org/). Good references and resources from a rather active community.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Kivy] Not listen for multi clicks dipbox 2 1,706 Nov-18-2021, 04:34 PM
Last Post: dipbox
  Checkbutton writing selection to file blakefindlay 1 2,108 Jan-28-2021, 01:56 PM
Last Post: deanhystad
  [Tkinter] How to insert 'Checkbutton' to 'Treeview' and associate each item? water 2 13,186 Dec-19-2020, 05:24 PM
Last Post: water
  Find Checkbutton State PEGylated_User 3 3,108 Oct-23-2020, 12:43 AM
Last Post: Larz60+
  [tkinter] not getting checkbutton value when clicked OogieM 5 6,044 Sep-20-2020, 04:49 PM
Last Post: deanhystad
  [Tkinter] ttk.Checkbutton set on/off ifigazsi 5 10,460 Apr-04-2020, 07:34 PM
Last Post: deanhystad
  tkinter checkbutton if checked MC2020 2 5,983 Jan-21-2020, 07:08 PM
Last Post: joe_momma
  [Tkinter] Can't seem to get the current state of a checkbutton. p_hobbs 6 3,335 Nov-07-2019, 11:38 PM
Last Post: p_hobbs
  [PyQt] Wonky Touch Events hessej 2 2,288 Nov-07-2019, 07:52 PM
Last Post: kozaizsvemira
  [Tkinter] Create a set of checkbutton widgets and refer to every one of them individually? Mariano 1 2,697 Apr-11-2019, 06:20 PM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020