forgive me for I am a beginner. I’m following a tuitorial for tkinter, a very basic one, but when i execute my code, I can only see a black screen with the button, no label or text input.
This is my very simple code for reference ‘
import tkinter as tk
window = tk.Tk()
window.title('MY first GUI')
window.configure(bg="white")
greeting = tk.Label(window, text="Hello Tkinter", fg="blue",bg='white')
greeting.pack()
button = tk.Button(window, text="I am a button")
button.pack()
textbox = tk.Text(window, font=("Arial",16))
textbox.pack()
window.mainloop()
I have tried setting the background as white, but that too doesn’t work. All I see is a black window with a button. I also downloaded tkinter via pip and brew.
New contributor
user24823602 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.