TkButton( WidgetName, [Options]...)

Create and manipulate button widgets

Arguments:

WidgetName - a standard path-like name used to name the widget.

Options - one or many descriptors for the options that are available for this widget.

Options:

command - Specifies a string to return from TkWait whenever mouse button 1 is released over the button. This is usually the name of a routine that will be interpreted as a call in the programs main message loop.

default - Specifies one of three states for the default ring: normal, active, or disabled. In active state, the button is drawn with the platform specific appearance for a default button. In normal state, the button is drawn with the platform specific appearance for a non-default button, leaving enough space to draw the default button appearance. The normal and active states will result in buttons of the same size. In disabled state, the button is drawn with the non-default button appearance without leaving space for the default appearance. The disabled state may result in a smaller button than the active state.

height - Specifies a desired height for the button. If an image or bitmap is being displayed in the button then the value is in screen units (i.e. any of the forms acceptable to TkGetPixels); for text it is in lines of text. If this option isn't specified, the button's desired height is computed from the size of the image or bitmap or text being displayed in it.

state - Specifies one of three states for the button: normal, active, or disabled. In normal state the button is displayed using the foreground and back- ground options. The active state is typically used when the pointer is over the button. In active state the button is displayed using the activeForeground and activeBackground options. Disabled state means that the button should be insensitive: the default bindings will refuse to activate the widget and will ignore mouse button presses. In this state the disabledForeground and background options determine how the button is displayed.

width - Specifies a desired width for the button. If an image or bitmap is being displayed in the button then the value is in screen units (i.e. any of the forms acceptable to TkGetPixels); for text it is in characters. If this option isn't specified, the button's desired width is computed from the size of the image or bitmap or text being displayed in it.

In addition, the following Standard Options are available: activebackground, activeforeground, anchor, background, bitmap, borderwidth, cursor, disabledforeground, font, foreground, highlightbackground, highlightcolor, highlightthickness, image, justify, padx, pady, relief, takefocus, text, textvariable, underline, wraplength

DESCRIPTION

The TkButton function creates a new window (given by the WidgetName argument) and makes it into a button widget. Additional options, described above, may be specified in the call or in the option database to configure aspects of the button such as its colors, font, text, and initial relief. The button function returns its WidgetName argument. At the time this function is invoked, there must not exist a window named WidgetName, but WidgetName's parent must exist.

A button is a widget that displays a textual string, bitmap or image. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the wrapLength option) and one of the charac- ters may optionally be underlined using the underline option. It can display itself in either of three different ways, according to the state option; it can be made to appear raised, sunken, or flat; and it can be made to flash. When a user invokes the button (by pressing mouse button 1 with the cursor over the button), then the string specified in the command option is returned by TkWait().