next up previous contents index
Next: Event handling Up: Tutorial Previous: The grid geometry manager   Contents   Index


Configuring widgets

Almost all aspects of widgets can be configured after creation via the configure function. It has the form: (configure widget option value) where widget is the widget to be configured, option the name of the option to configure (on the Lisp side a string or a keyword) and value any printable value that should be set for the option or a tkobject. Options used by all widgets are (not complete):

anchor position n, ne, e, se, s, sw, w, nw, center
background color Background color of the widget
bitmap bitmap Specifies a bitmap to display in the widget.
borderwidth width borderwidth in pixels
cursor cursorname Set the icon for the mouse cursor. A list of portable names is in the variable *cursors.
foreground color Foreground color.
image image Photo image to be displayed on the widget.
justify value Justification of text displayed on the widget, may be left, center, or right.
padx pixels Extra padding around the widget.
pady pixels Extra padding around the widget.
relief value Effect for border display. May be raised, sunken, flat, ridge, solid, or groove.
orient orientation The orientation of the widget (e.g. for scrollbars). May be horizontal or vertical.
takefocus takeit 0 or 1, determines whether the widget accepts the focus.
text string The text to be displayed on the widget.
underline index The index of the character to underline in the text of the widget for keyboard traversal.

Example: (configure txt :background :blue)


next up previous contents index
Next: Event handling Up: Tutorial Previous: The grid geometry manager   Contents   Index
Peter Herth 2006-01-29