0

I wanted to do my first tkinter code with python3, but when I used the code below a window opens up without any text. If somebody nows how to fix this please let me now. I already have the latest version of tkinter and I am using the mac terminal

P.S. When I try to open the window with tkinter, this error message always pops up:

DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.

This is my code.

from tkinter import *

root = Tk()

myLabel1 = Label (root, text="Hello World!")
myLabel2 = Label (root, text="My name is Bugs Bunny.")

myLabel1.grid(row=0, column=0)
myLabel2.grid(row=1,column=0)

root.mainloop()
acw1668
  • 40,144
  • 5
  • 22
  • 34
Enno
  • 1
  • 2
  • Check the version of `tk` using `print(root.tk.call('info', 'patchlevel'))`. Try reinstall python downloaded from python.org. – acw1668 Dec 28 '22 at 15:48
  • Are you on osx, and does the window come up black? It's a known problem on the Mac. Install python from python.org or homebrew and your code should work fine. – Bryan Oakley Dec 28 '22 at 15:51
  • It is macOS Catalina. here is link. https://stackoverflow.com/questions/58752385/tkinter-test-buttons-are-invisible-when-using-pipenv – toyota Supra Dec 29 '22 at 02:37

0 Answers0