Home > Software engineering >  Tkinter window appears black upon running in PyCharm
Tkinter window appears black upon running in PyCharm

Time:03-03

Tkinter background appears black upon running script no matter how I attribute the background colour.

I'm using PyCharm CE 2021.3.2 on macOS 12.2.1.

Python Interpreter = Python 3.8 with 5 packages (as follows):

  • Pillow 9.0.1
  • future 0.18.2
  • pip 22.0.3
  • setuptools 57.0.0
  • wheel 0.36.2

Window looks like this: Black, blank Tkinter window

I've tried:

import tkinter as tk

window = tk.Tk()
window.title("Test")

window.geometry("600x400")

window.mainloop()

Tried changing with window.configure(bg="white") as well as window['bg'] = "white" and window['background'] = "white" to no avail.

Thank you.

CodePudding user response:

Thanks to @typedecker

Issue was with Python 3.8 and the Monterey update.

Fix:

First install Python 3.10 then follow this tutorial:

Creating Python 3.10 Virtual Env

Then simply select the newly created virtual env in PyCharms and run.

  • Related