Tkinter supplies many kinds of widgets, and most of them have several things in common. All widgets are instances of classes that inherit from class
Widget itself is abstract; that is, you never instantiate
Widget itself. You only instantiate concrete subclasses corresponding to specific kinds of widgets. Class
Widget’s functionality is common to all the widgets you instantiate.
To instantiate any kind of widget, call the widget’s class. The first argument is the parent window of the widget, also known as the widget’s master. If you omit this positional argument, the widget’s master is the application’s main window. All other arguments are in named form:
value. To set or change options on an existing widget
). To get an option of
'), which returns the option’s value. Each widget
w is a mapping, so you can also get an option as
'], and set or change it with
Many widgets accept some common options. Some options affect a widget’s colors, while others affect lengths (normally in pixels), and there are various other kinds. This section details the most commonly used options.
Tkinter represents colors with strings. The string can be a color name, such as
'orange', or it may be of the form
', where each
B are hexadecimal digits that represent a color by the values of red, green, and blue components on a scale of ...