Before start from widgets we need to understand the difference between windows and widgets.
widgets- GUI elements
windows- server as a container to hold these widgets.
A widget is an element of the graphical user interface(GUI) that displays information or provides a specific way for a user to interact with the operating system or an application.
Some popular widgets are:
Label : You can set the label font so you can make it bigger and maybe bold.
Example:
output:
Button : we can add buttons on window as same as the label.
Example:
Output:
here, grid function is used to set the button position and grid function is a geometry function.We can set the default window size using geometry functions: pack(), grid() and place().
REMARK: there is a separate Article " Tkinter Geometry Managers"
to add button click event we will write the function that we need to execute when the button is clicked
Example:
Entry Widget - It is used to create input fields in GUI.
Example-
Combobox Widget: Combobox is just dropdown menu with options.
Example:
Checkbutton Widget:
Example:
Radiobutton Widget:
Example:
Comments