DEV Community

Cover image for Learning Python- Intermediate course: Day 19, Tkinter — Types of Widgets part 2
Aatmaj
Aatmaj

Posted on

Learning Python- Intermediate course: Day 19, Tkinter — Types of Widgets part 2

Today we will cover the more types of the widgets in Tkinter.


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.

Types of widgets in Tkinter continued..........

  • 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.
image

  • Label

The label widget is an output type of widget. It is used to display text values in the application.
image

  • 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.
image

The user can choose one or more items from the list depending upon the configuration.

image

  • Menubutton

Menu button is a drop-down menu. We can select one or more options from the drop down menu box.

image
The drop down opens once the menu button is clicked.
image

  • 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.

image

  • 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.

image

  • 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.
image

  • 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.
image

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


To be continued.....

Image credits- All images in the text are my own screenshots.

Top comments (0)