I am learning Tkinter right now. For some reason, no matter what I try, I can't get the label to appear on a very simple program. I've checked some other questions but none of them seem to work.
I am working on macOS 14.3, with the Apple Silicon chip.
Here is my code:
from tkinter import *
root = Tk()
root.title("Test")
root.geometry('350x200')
lbl = Label(root, text = "TestTest")
lbl.grid()
root.mainloop()
For some reason, only a blank window is appearing.
-
1There are some know issues with tkinter on Mac OS. I have an answer here that might help you out.JRiggles– JRiggles2024年10月15日 19:42:00 +00:00Commented Oct 15, 2024 at 19:42
-
Thank you for your help. Unfortunately the "pyenv uninstall 3.10.5" command isn't working. I replaced it with my current version of python, but it just tells me that that version isn't installed.user27819719– user278197192024年10月15日 19:50:05 +00:00Commented Oct 15, 2024 at 19:50
-
1That's to be expected if you don't already have that version of Python installed via pyenv. If that's the case, you can skip that step. I've updated the linked answer to clarify that the uninstall steps are conditional.JRiggles– JRiggles2024年10月15日 19:53:43 +00:00Commented Oct 15, 2024 at 19:53
-
OK THIS WORKED THANK YOU SO MUCHuser27819719– user278197192024年10月15日 19:59:22 +00:00Commented Oct 15, 2024 at 19:59
-
Glad I could help! If this worked for you, upvotes on the answer are always appreciated - it helps guide others to things that work.JRiggles– JRiggles2024年10月15日 20:03:38 +00:00Commented Oct 15, 2024 at 20:03
lang-py