0

TKinter window is blank/grey on macOS.

I have the default version of Tkinter (8.5), Python 3.10.11 through pyenv installed with macOS Ventura 13.3.1 on a Macbook Pro M2 (2023)

When I try tkinter._test(), the window below appears.

enter image description here

I have observed a strange behavior that whenever I place a button in the window, the window background is black and the button appears (yet no labels do, regardless of color settings).

When I place labels only, the window is just grey.

Example:

import tkinter as tk

root = tk.Tk()

label = tk.Label(root, text="Hello World!", fg="red")
label.pack()
root.mainloop()

results in

enter image description here

Yet,

import tkinter as tk

root = tk.Tk()

label = tk.Label(root, text="Hello World!", fg="red")
label.pack()
button = tk.Button(root, text="Click Me", fg="blue")
button.pack()
root.mainloop()

results in this

enter image description here

I have tried upgrading to Tkinter 8.6 through homebrew using the instructions in various posts, however, this didn't work - python is always using 8.5. But since this issue is so particular, I suspect that it might be independent of the version anyway.

Would appreciate any help!

MThiele
  • 40
  • 3
  • Did you fix this? I've tried many different suggestions for m2 but no luck. For example https://stackoverflow.com/questions/22550068/python-not-configured-for-tk – Dan Jul 19 '23 at 12:44

0 Answers0