33
Learning Python- Intermediate course: Day 19, Tkinter β Types of Widgets part 2
Recap widgets are graphical elements like buttons, frames, textboxes etc. which are helpful in taking input from the user in graphical format. In the last part we saw different types of widgets like checkboxes, radio-buttons and simple buttons. In case you have missed the last part here is the link.
- Frame
The Frame widget is like a photo frame. We can stick on various types of widgets into this 'container'. It has only one job- To provide a place where other widgets can be fixed. A blank frame is just like a plain sheet.
- Label
- Listbox
Listbox also is output type of widget. It can display only text elements. Moreover, all the text items must contain the same font and colour.
The user can choose one or more items from the list depending upon the configuration.
- Menubutton
Menu button is a drop-down menu. We can select one or more options from the drop down menu box.
- Scale
The Scale widget is a very interesting widget. It is used to create a graphical slider which the user can move around for the input.
We can control the minimum and maximum values along with the resolution of the scale. It provides a 'continues' alternative to 'discrete' radio buttons. Which means rather then having to specify 50 checkboxes we can just have one slider. It is useful over the Entry widget when the user is forced to select only one value from the given range of values.
- Scrollbar
Everyone knows what a scrollbar is. The scrollbar widget is used to scroll down the content of the other widgets like listbox, text, and canvas.
We can also create the horizontal scrollbars to the Entry widget.
- Entry
The entry widget is a widget which takes in textual input. It can only be used for taking in one line of text from the user.
- Text
The Text widget is used to show the text data on the Python application. However, Tkinter provides us the Entry widget which is used to implement the single line text box.
The difference between a text-box and entry widget is that entry widget can only take input of one line while textbox can accept multiline inputs
Image credits- All images in the text are my own screenshots.
33