Exploring Tkinter widgets
When we designed our application, we picked out a widget class that most closely matched each field we needed. These were the Entry
, Spinbox
, Combobox
, Checkbutton
, and Text
widgets. We also determined that we'd need the Button
and LabelFrame
widgets to implement the application layout. Before we start writing our class, let's take a look at each of these widgets.
Note
Some of our widgets are in Tkinter, others are in the ttk
themed widget set, and a few are in both libraries. We prefer the ttk
versions wherever they exist, since they look better across platforms. Pay careful attention to the library from which we import each widget.
The Entry widget
The ttk.Entry
widget is a basic, one-line character entry, as shown in the following screenshot:

You can create an entry by executing the following code:
my_entry = ttk.Entry(parent, textvariable=my_text_var)
In the preceding code, the commonly used arguments to ttk.Entry
are as follows:
parent
: This argument sets theparent...