A StringVar object is like a string variable. It can be linked to widgets like Label and Entry, and will automatically show what it contains at all times
.set()
and .get() methods can set and get the value of a StringVar
IntVar (and others) also exist, for different data types!
GUI programs can recreate almost all programs from the unit
GUI consists of
frames, labels, entries and buttons
Implementing the GUI in the constructor
1. create Frame widgets
2. create and pack height Label and Entry widgets
3. create and pack weight Label and Entry widgets
4. create and pack Button widgets
5. pack Frame widgets
6. set initial focus on height Entry widget
show_result()
calculate and show BMI, or error message
reset_form()
clear both Entry widgets and set focus on height
GUI-based programs
event-driven; Code handles events that are triggered by users interacting with the GUI
GUI elements ("widgets")
include buttons, text entry fields, labels
Settings
can control text, font, size, colours, padding, alignment and more
Packing
Widgets must be packed into the GUI, and frames can help achieve desired layout
Messageboxes
can be used to show pop-up information / warning / error boxes
Confirmation/decision boxes
Can also show boxes with OK/Cancel, Yes/No and Retry/Cancel buttons