0

Python noob here, ive started a tkinter tutorial and no matter what method I use to change the background color it stays black. Im using vs code on mac and I made sure everything is updated. Ive also tried it in pycharm and the same problem occurs. Im not getting any errors in the terminal. Here is what I have,

from tkinter import *

window = Tk()
window.geometry("500x500")
window.title("Weather.py")
window.config(bg="blue")
window.mainloop()

Any ideas?

Update: Tried it on another mac in the house and is seemed to work on that one. Not sure why it wont work on mine.

  • Have you tried running it directly from Terminal? It works fine for me on Windows. – MattDMo Aug 15 '22 at 15:03
  • Hey Matt, thanks for the tip. Yes I just made sure that i have been running in the terminal. Still that black screen rather than a blue one. It displays my title at the top. I thought that maybe it had something to do with the fact that I had dark mode turned on, but with that turned off now it still shows the same thing. Weird... –  Aug 15 '22 at 16:07
  • What version of python do you have? Maybe try updating to the newest version? Looks like it might be similar to [this discussion](https://stackoverflow.com/questions/71294521/tkinter-window-appears-black-upon-running-in-pycharm) – Rory Aug 15 '22 at 21:09
  • This works on my windows as well. Have you tried reinstalling `Python` or the `Tkinter` package? – MingJie-MSFT Aug 16 '22 at 03:04
  • @bob_has_a_question Maybe you can try doing it in IDLE. – Albert_coding Aug 16 '22 at 03:04

1 Answers1

0

Link provided by @Rory did the trick... Along with several restarts of both the computer and vs code.