Appendix B. Quick Reference Sheets

Large portions of the appendix have been generated from the built-in Tkinter documentation, and are accordingly copyright of Python Software Foundation (Copyright © 2001-2013 Python Software Foundation; All Rights Reserved).

Options common to widgets

The following table consists options common to most of the widgets their functionalities and the list of widgets to which the options are not applicable:

Widget option

Function

Not applicable to widgets

background (bg)

Picks background color.

 

borderwidth (bd)

Defines width of border in pixel.

 

cursor

It is the mouse cursor to be used for the widget.

 

relief

It specifies the border style for a widget.

 

takefocus

If window accepts focus during keyboard traversal.

 

width

An integer specifying the relative width of a widget.

Menu

font

It specifies font family and font size.

Toplevel, Canvas, Frame, and Scrollbar

foreground (fg)

It specifies foreground color.

Toplevel, Canvas, Frame, and Scrollbar

highlightbackground

color

Menu

highlightcolor

color

Menu

highlightthickness

It is measured in pixels.

Menu

relief

Specifies the 3D effect to be applied to a given widget. Valid values are RAISED, SUNKEN, FLAT, RIDGE, SOLID, and GROOVE.

 

takefocus

Specified as 1 or 0 representing whether or not a widget takes focus during keyboard tab-based traversal.

 

width

Integer specifying the width of a widget.

Menu

The following table consists options common to most of the widgets their functionalities and the list of widgets to which the options are applicable:

Widget Option

Function

Applicable to

activebackground

Color of background when widget is active.

Menu, Menubutton, Button, Checkbutton, Radiobutton, Scale, and Scrollbar

activeforeground

Color of foreground when widget is active.

Menu, Menubutton, Button, Checkbutton, and Radiobutton

anchor

Indicates where text or a bitmap would be displayed on a widget. Valid values are n, ne, e, se, s, sw, w, nw, or center.

Menubutton, Button, Checkbutton, Radiobutton, Label, and Message

bitmap

Indicates a bitmap to display in the widget.

Menubutton, Button, Checkbutton, Radiobutton, and Label

command

Indicates a command callback to associate with the widget, which would be normally invoked on mouse button 1 release over the widget.

Button, Checkbutton, Radiobutton, Scale, and Scrollbar

disabledforeground

Indicates the foreground color to display when a widget is in disabled state.

Menu, Menubutton, Button, Checkbutton, and Radiobutton

height

Indicates height of widget, in units in which the font has been specified for the given widget.

Toplevel, Menubutton, Button, Checkbutton, Radiobutton, Label, Frame, Listbox, and Canvas

image

Indicates an image to display in the widget.

Menubutton, Button, Checkbutton, Radiobutton, and Label

justify

Applicable when multiple lines of text are displayed in a widget. This determines how the text lines line up with each other. Must be one of LEFT, CENTER, or RIGHT.

Menubutton, Button, Checkbutton, Radiobutton, Label, Entry, and Message

selectbackground

Indicates the background color to show when displaying selected items.

Text, Listbox, Entry, and Canvas

selectborderwidth

Indicates the border width to show when displaying selected items.

Text, Listbox, Entry, and Canvas

selectforeground

Indicates the foreground color to show when displaying selected items.

Text, Listbox, Entry, and Canvas

state

Indicates one of two or three states that a widget may be under. Valid values normal, active, or disabled.

Menubutton, Button, Checkbutton, Radiobutton, Text, Entry, and Scale

text

Indicates a string to be displayed inside the widget.

Menubutton, Button, Checkbutton, Radiobutton, Label, and Message

textvariable

Indicates the name of a variable. The value of the variable is changed to string in order to be displayed in the widget. The widget automatically updates as and when the variable value changes.

Menubutton, Button, Checkbutton, Radiobutton, Label, Entry, and Message

underline

Indicates the integer index of a character to underline in the widget.

Menubutton, Button, Checkbutton, Radiobutton, and Label

wraplength

Indicates the maximum line length for widgets that have word wrapping.

Menubutton, Button, Checkbutton, Radiobutton, and Label

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.131.255