Closed GabeMillikan closed 2 years ago
P.S. If I use .pack()
instead of .grid()
, then the checkbox starts out small, whereas with .gird()
you have to hover over it for it to become small.
I actually located the problem. pyautogui imports pyscreeze, which executes this code:
import ctypes
ctypes.windll.user32.SetProcessDPIAware()
Which is the cause of this bug. I now believe that this is actually a Tkinter bug, and not pyscreeze nor pyautogui's problem (since the ctypes code is required for them to take accurate screenshots).
The size of window seems the cause of this "bug": superposition of checkbox area and resize handle... This code works perfectly (Mac OS X / Python 3.9.6):
import tkinter as tk
from tkinter import ttk
import pyautogui
w = tk.Tk()
f = tk.Frame()
w.title('Better')
w.geometry('150x40') # sufficient window size
ttk.Checkbutton(f, text = "Checkbox").pack()
f.grid()
w.mainloop()
Code:
Result:
New code after removing pyautogui import:
Result:
I am on 64bit Windows 11 and using Python 3.8.10, but I'm not sure that this is platform specific. Would love for people on other systems to check if the same issue occurs.