I'm new to tkinter. I tried the execute the following:
from tkinter import *
root = Tk()
myLabel1 = Label(root, text="Hello World!")
myLabel1.pack()
root.mainloop()
An window shows up but there is no labels.
I'm running MacOS 13.0.1, Python 3.9.6.
Is this a bug? Am I running an obsolete version of tk?
I've tried to add a root.update() before calling mainloop() as someone suggested. That didn't resolve the issue. I've also tried to set geometry to root and that just give me a bigger empty window.
CodePudding user response:
I'm On Windows 10 And Program Worked Fine :
So, Your Problem Isn't Code Part !
Use pip3 install tk
in MacOS to install correct version
CodePudding user response:
pip install tkmacosx
Try this:
from tkinter import Tk
from tkmacosx import LAbel
root = Tk()
myLabel1 = Label(root, text="Hello World!")
myLabel1.pack()
root.mainloop()