Table 27-1 lists the attributes for the button, checkbutton, menubutton, and radiobutton widgets. Unless otherwise indicated, the attributes apply to all of these widget types. Chapters 37, 38, and 39 discuss many of these attributes in more detail. Some attributes are ignored on the Windows and Macintosh platforms because they are not supported by the native button widgets.
The table uses the resource name for the attributes, which has capitals at internal word boundaries. In Tcl commands, the attributes are specified with a dash and they are all lowercase. Compare:
option add *Menubutton.activeBackground: red .mb configure -activebackground red
The first command defines a resource database entry that covers all menubuttons and gives them a red active background. This only affects menubuttons created after the database entry is added. The second command changes an existing menubutton (.mb) to have a red active background. Note the difference in capitalization of background in the two commands. The resource database is introduced on page 311, and Chapter 28 explains how to use the resource database in more detail.
activeBackground | Background color when the mouse is over the button. |
activeForeground | Text color when the mouse is over the button. |
anchor | Anchor point for positioning the text. |
background | The normal background color. |
bitmap | A bitmap to display instead of text. |
borderWidth | Width of the border around the button. |
command | Tcl command to invoke when button is clicked. |
cursor | Cursor to display when mouse is over the widget. |
default | active displays as a default button. normal and disabled display as normal button. See page 715 (Tk 8.0). |
direction | up, down, left, right, active. Offset direction for posting menus. menubutton. (Tk 8.0). |
disabledForeground | Foreground (text) color when button is disabled. |
font | Font for the text. |
foreground | Foreground (text) color. (Also fg). |
height | Height, in lines for text, or screen units for images. |
highlightBackground | Focus highlight color when widget does not have focus. |
highlightColor | Focus highlight color when widget has focus. |
highlightThickness | Width of highlight border. |
image | Image to display instead of text or bitmap. |
indicatorOn | Boolean that controls if the indicator is displayed: checkbutton, menubutton, or radiobutton. |
justify | Text justification: center, left, or right. |
menu | Menu posted when menubutton is clicked. |
offValue | Value for Tcl variable when checkbutton is not selected. |
onValue | Value for Tcl variable when checkbutton is selected. |
padX | Extra space to the left and right of the button text. |
padY | Extra space above and below the button text. |
relief | flat, sunken, raised, groove, solid or ridge. |
selectColor | Color for selector. checkbutton or radiobutton. |
selectImage | Alternate graphic image for selector: checkbutton or radiobutton. |
state | Enabled (normal) or deactivated (disabled). |
takeFocus | Control focus changes from keyboard traversal. |
text | Text to display in the button. |
textVariable | Tcl variable that has the value of the text. |
underline | Index of text character to underline. |
value | Value for Tcl variable when radiobutton is selected. |
variable | Tcl variable associated with the button: checkbutton or radiobutton. |
width | Width in characters for text, or screen units for image. |
wrapLength | Maximum character length before text is wrapped, in screen units. |
3.15.237.89