Python GUI – Short Notes with Simple Examples
1. GUI:
- GUI allows interaction using windows, buttons, text boxes.
- Python uses Tkinter for GUI.
2. Tkinter Basics:
- from tkinter import *
- root = Tk()
- [Link]()
3. Label Example:
Label(root, text="Hello").pack()
4. Button Example:
Button(root, text="Click", command=func).pack()
5. Entry Example:
Entry(root).pack()
6. Geometry Managers:
- pack(), grid(), place()
7. Checkbutton & Radiobutton:
- Checkbutton(root, text="I Agree").pack()
- Radiobutton(root, text="Male", value=1).pack()
8. Messagebox:
[Link]("Info", "Hello")
9. File Dialog:
[Link]()
10. Canvas Example:
canvas.create_rectangle(50,50,150,100)
11. Menu Example:
Menu(root); add_command()
12. Simple Add Program:
result = int([Link]()) + int([Link]())