Purple Hat – Games & GUI
advanced40 XP
Tkinter GUI Apps
Build desktop apps with buttons, labels, and input fields
Tkinter GUI
Python
import tkinter as tk
window = tk.Tk()
window.title("My App")
label = tk.Label(window, text="Hello!", font=("Arial", 24))
label.pack(pady=20)
def on_click():
label.config(text="Button clicked!")
btn = tk.Button(window, text="Click Me!", command=on_click)
btn.pack()
window.mainloop()⌨️
Type it yourself
Don't just read it — type the example from above into the box, press Run ▶, and watch what happens. Typing it yourself is how it really sticks! Stuck? Tap Show example.
Python · Playground
Output
Press ▶ Run to see your code come to life…Quick check
01/2
Which method starts the Tkinter event loop?