Widget classes
Tkinter supports 15 core widgets:
Button: A simple button, used to execute a command or other operation.
Syntax:
w = Button ( master, option=value, ... )
Canvas: Structured graphics. This widget can be used to draw graphs and plots, create graphics editors, and to implement custom widgets.
A canvas is added with one line of code:
Syntax:
myCanvas = tkinter.Canvas(root, option=value, ...)
Checkbutton: Represents a variable that can have two distinct values. Clicking the button toggles between the values.
Syntax:
w = Checkbutton ( master, option, ... )
Entry: A text entry field.
Syntax:
w = Entry( master, option, ... )
Frame: A container widget. The frame can have a border and a background, and is used to group other widgets when creating an application or dialog layout.
Syntax:
w = Frame ( master, option, ... )
Label: Displays a text or an image.
Syntax:
w = Label ( master, option, ... )
Listbox: Displays a list of alternatives. The listbox can be configured to get radiobutton or checklist behavior.
Syntax:
w = Label ( master, option, ... )
Menu: A menu pane. Used to implement pulldown and popup menus.
Syntax:
w = Menu ( master, option, ... )
Menubutton: A menubutton. Used to implement pulldown menus.
Syntax:
w = Menubutton ( master, option, ... )
Message: Display a text. Similar to the label widget, but can automatically wrap text to a given width or aspect ratio.
Syntax:
w = Message ( master, option, ... )
Radiobutton: Represents 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 associated with the same variable.
Syntax:
w = Radiobutton ( master, option, ... )
Scale: Allows you to set a numerical value by dragging a “slider”.
Syntax:
w = Scale ( master, option, ... )
Scrollbar: Standard scrollbars for use with canvas, entry, listbox, and text widgets.
Syntax:
w = Scrollbar ( master, option, ... )
Text: Formatted text display. Allows you to display and edit text with various styles and attributes. Also supports embedded images and windows.
Syntax:
w = Text ( master, option, ... )
Toplevel: A container widget displayed as a separate, top-level window.
Syntax:
w = Toplevel(options)