Python Tkinter class __python

Source: Internet
Author: User
Tags numeric value pack
Tkinter Classes Widget Classes

Tkinter supports core widgets:

Tkinter supports 15 core components:ButtonA simple button that used to execute a command or other operation. Button: A simple button that performs a command line or other operation.CanvasStructured graphics. This widget can is used to draw graphs and plots, the create graphics editors, and to implement custom widgets. Canvas: Structured images. This component can be used by users to draw images and graphs, create image editors, and deploy custom components.
CheckbuttonRepresents a variable that can have two distinct values. Clicking the button toggles between the values. Select button: Represents a variable that can have two opposite values. You can switch between two values by clicking the button.EntryA text Entry field. Text area: Text input areaFrameA Container widget. The frame can have a border and a background, and is used to group other widgets when creating a application or Dialog LA Yout. Frame: Container component. A container can have a border and a background. User groups are divided into other components when creating an application or session layout.LabelDisplays a text or an image. Tags: Displays a text or image.ListboxDisplays a list of alternatives. The listbox can be configured to get RadioButton or checklist behavior. ListBox: Displays a list of candidate values that can be configured as a single selection or as a check.MenuA Menu pane. Used to implement pulldown and popup menus. Menu: a menu box. The user deploys a Drop-down or pop-up menu.MenubuttonA Menubutton. Used to implement pulldown menus. Menu button: The user deploys the Drop-down menu. MessageDisplay a text. Similar to the label widget, but can automatically wrap text to a given width or aspect ratio. Message: Displays a text. Similar to a label component, but can automatically wrap text into a given width or scale.RadiobuttonRepresents one value of a variable that can have one of many values. Clicking the button sets the "variable" to "that" value, and clears all other radiobuttons with the associated same. Radio button: Represents a value for a variable that has more than one value. Click this button to set the variable to the corresponding value, while clearing the other radio buttons associated with the variable.ScaleAllows to set a numerical value by dragging a "slider". Slider: Allows you to set a digitized value by dragging to the slider.ScrollbarStandard scrollbars for use with canvas, entry, ListBox, and text widgets. Scroll bars: Standard scroll bars are used in canvas, text input areas, list boxes, and text components.TextFormatted text display. Allows to display and edit-text with various styles and attributes. Also supports embedded images and windows. Text: Formatted text display. Allows you to display and edit text in a variety of formats and properties. Supports embedded images and windows.TopLevelA container widget displayed as a separate, top-level window. Top-level window, a container component that appears as a stand-alone top-level window.

In Python 2.3 (Tk 8.4), the following widgets were added:

The following components are added to Python2.3 (Tk8.4): labelframe A variant of the Frame widget that can draw both a border and a title. Label Box: A variant of a frame component that can draw borders and headings. Panedwindow A Container widget that organizes child widgets in resizable panes. Panel: A container component that organizes child components in a resizable window. Spinbox A variant of the Entry widget for selecting values from a range or a ordered set. Rotate box: A variant of a text input box in which the user selects a numeric value from an arrangement or an ordered set.

Also Note that there ' s no widget class hierarchy in Tkinter; All widgets classes are siblings in the inheritance tree.

Note that there is no component class level in the Tkinter, and all component classes in the inheritance tree are siblings.

All of these widgets provide Misc and Geometry management methods, the configuration management methods, and add Itional methods defined by the widget itself. In addition, the TopLevel class also provides the window manager interface. This is means that a typical widget class provides some methods.

All components provide misc and geometry management methods, configuration management methods, and other methods defined by the components themselves. In addition, the TopLevel class also provides a window management interface. This means that a typical component class provides almost 150 methods. mixins

The Tkinter module provides classes corresponding to the various widget types in Tk, and a number of mixin and other Helpe R classes (a mixin is a class designed to being combined with the other classes using multiple inheritance). When your use Tkinter, you should never access the Mixin classes directly.

The Tkinter module provides classes and a series of mixin and other help classes that correspond to various component types in TK (Mixin class users inherit the entire other class through multiple inheritance). implementation Mixins

The Misc class is used as a mixin by the root window and widget classes. It provides a large number of Tk and window related services, which are thus for all available core tkinter. This is doing by delegation; The widget simply forwards the request to the appropriate internal object.

The Misc class is used as a mixin by the root window and the component class. It provides a wide range of TK and window services, and these service teams tkinter core components are very helpful. These are implemented through authorization: components need to be delivered to the appropriate internal object.

The Wm class is used as a mixin by the root window and toplevel widget classes. It provides window manager services, also by delegation.

The WM class is used as a mixin by the root window and the TopLevel component, which provides window management services through authorization.

Using delegation like this simplifies your application code:once your have a widget, you can access all parts of Tkinter u Sing methods on the widget instance.

A license like this simplifies the application code: Once you have a component, you can access all parts of Tkinter using the method of the component instance. Geometry mixins

The Grid, Pack, and place classes are used as mixins by the widget classes. They provide access to the various geometry managers, also via delegation.

Grid, pack, and place classes are used by components as mixin. They provide permissions to access various geometry managers by authorization. Grid The grid Geometry Manager allows you to create table-like layouts by organizing the widgets in a 2-dimensional grid. To the Geometry manager, use the  grid  method. Grid: The grid Geometry Manager can create a diagram-like layout by organizing the components into a two-dimensional grid. You can use this geometry management with the grid method. Pack The pack Geometry Manager lets you create a layout by  "packing"  the to a parent widget, by widgets th EM as rectangular blocks placed in a frame. To the Geometry manager for a widget, use the  pack  method on, widget to set things up . Package geometry management can be done by packaging components and parent components to create layouts as rectangular blocks in the frame.
Place The place Geometry Manager lets your explicitly place a widget in a given position. To the Geometry manager, use the the  place  method. Place several managers can accurately position components to a given location. You can use the place method to work with this few managers. Widget Configuration Management

The Widget class mixes the Misc class with the geometry mixins, and adds configuration management H the cget and Configure methods, as as and through a partial dictionary. The latter can used to set and query individual options, and are explained in further detail in the next chapter.

The Widget class mixes misc classes with several Minixs and adds configuration management through the Cget and configure methods.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.