Reputation: 113
tkinter
is only partially working for me. The tk._test()
works, and when the backend is inline
, tkinter
does not work, but if I switch it to Tkinter
after having tried running the below code with the Graphics backend set to inline
, a bunch of tkinter
windows will appear. Unfortunately, that is all. If I try running tkinter
from then out, no new popups will appear. Nothing seems to happen, it is as if it get frozen.
This is what I am trying to run
import tkinter as tk
window = tk.Tk()
greeting = tk.Label(text="Hello, Tkinter")
greeting.pack()
I am running python 3.8.8. I can't figure out what version spyder is... but it isn't the latest one.
Upvotes: 0
Views: 766
Reputation: 4564
You are missing window.mainloop()
.
import tkinter as tk
window = tk.Tk()
greeting = tk.Label(text="Hello, Tkinter")
greeting.pack()
window.mainloop()
Result output image:
Upvotes: 0
Reputation: 61
Try this code:
import tkinter as tk
window = tk.Tk()
greeting = tk.Label(window, text="Hello, Tkinter")
greeting.pack()
You forgot to add the window when creating the Label.
Upvotes: 1