Tkinter is the default GUI toolkit for Python. It lets you build windows, buttons, labels, textboxes, and other UI elements fast and easy.
This demo shows how to create a basic window with a clickable button.
tk.Tk()
creates the main application window.Button
, Label
, Entry
are common widgets.pack()
, grid()
, and place()
arrange widgets on screen.command
binds a function to button clicks.mainloop()
starts the event loop to keep the window open.Adding a label and text input to greet the user by name.
pack()
for quick layouts, but for complex apps, learn grid()
for better control.