Python Tkinter Journal

 Python Tkinter Journal


by Tommy Smith



Standard Attributes

These are the configurable attributes of widgets.

borderwidth − Width of the border which gives a three-dimensional look to the widget.


highlightthickness − Width of the highlight rectangle when the widget has focus.


padX padY − Extra space the widget requests from its layout manager beyond the minimum the widget needs to display its contents in the x and y directions.


selectborderwidth − Width of the three-dimentional border around selected items of the widget.


wraplength − Maximum line length for widgets that perform word wrapping.


height − Desired height of the widget; must be greater than or equal to 1.


underline − Index of the character to underline in the widget's text (0 is the first character, 1 the second one, ...).


width − Desired width of the widget.


activebackground − Background color for the widget when the widget is active.


activeforeground − Foreground color for the widget when the widget is active.


background − Background color for the widget. This can also be represented as bg.


disabledforeground − Foreground color for the widget when the widget is disabled.


foreground − Foreground color for the widget. This can also be represented as fg.


highlightbackground − Background color of the highlight region when the widget has focus.


highlightcolor − Foreground color of the highlight region when the widget has focus.


selectbackground − Background color for the selected items of the widget.


selectforeground − Foreground color for the selected items of the widget.

Example: font = (“None”, “24”, “bold italic”)

The first element is the font family, followed by a size in points, optionally followed by a string containing one or more of the style modifiers bold, italic, underline and overstrike. “None” as a font family uses the default font.

Example: anchor=NE

Anchors are used to define where text is positioned relative to a reference point.

Here is list of possible constants, which can be used for Anchor attribute.


NW

N

NE

W

CENTER

E

SW

S

SE

Example: relief=FLAT

The relief style of a widget refers to certain simulated 3-D effects around the outside of the widget.

Here is list of possible constants which can be used for relief attribute.


FLAT

RAISED

SUNKEN

GROOVE

RIDGE

Here is the list of interesting ones −"arrow", "circle", "clock", "cross", "dotbox", "exchange","fleur", "heart", "man", "mouse", "pirate", "plus", "shuttle", "sizing", "spider", "spraycan", "star", "target", "tcross", "trek", "watch"


No comments:

Post a Comment