JavaScript EditorFree JavaScript Editor     Perl Manuals 



Main Page

4.3. Table of Options for Button-Type Widgets

The Button widgets share almost all of the same options. Table 4-1 shows a complete list of options and which widget they apply to. We'll cover these options in more detail as we explore what Buttons can do.

In the details following Table 4-1, all information applies equally to Buttons, Checkbuttons, and Radiobuttons unless explictly stated otherwise.

Table 4-1. Options for Button-type widgets

Option

Button

Checkbutton

Radiobutton

-activebackground => color
Sets the color the background should be when the mouse cursor is over the Button. A color is a text string such as "red".

Figure 4-1

Figure 4-1

Figure 4-1

-activeforeground => color
Sets the color the text should be when the mouse cursor is over the Button.

Figure 4-1

Figure 4-1

Figure 4-1

-anchor => 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw' | 'center'
Causes the text to stick to the specified position in the Button.

Figure 4-1

Figure 4-1

Figure 4-1

-background => color
Sets the background of the Button to color.

Figure 4-1

Figure 4-1

Figure 4-1

-bitmap => 'bitmapname'
Sets default bitmap or the location of a bitmap file (with @ in front of path). See Chapter 17, "Images and Animations" for more details.

Figure 4-1

Figure 4-1

Figure 4-1

-borderwidth => amount
Changes the width of the edge drawn around the Button and the thickness of the indicator. Emphasizes the -relief of the Button.

Figure 4-1

Figure 4-1

Figure 4-1

-command => callback
Indicates a pointer to a function that will be called when the Button is pressed.

Figure 4-1

Figure 4-1

Figure 4-1

-cursor => 'cursorname'
Indicates that the mouse cursor will change to 'cursorname' when over the Button. See Chapter 23, "Plethora of pTk Potpourri" for details.

Figure 4-1

Figure 4-1

Figure 4-1

-disabledforeground => color
Sets the color the text should be when the Button is disabled (-state will be 'disabled').

Figure 4-1

Figure 4-1

Figure 4-1

-font => 'fontname'
Changes the font of all text on the Button.

Figure 4-1

Figure 4-1

Figure 4-1

-foreground => color
Changes the text color to color.

Figure 4-1

Figure 4-1

Figure 4-1

-height => amount
Sets the height of the Button in characters if text is displayed and the screen distance if an image or bitmap is displayed.

Figure 4-1

Figure 4-1

Figure 4-1

-highlightbackground => color
Sets the color of the area behind the focus rectangle (shows when widget does not have focus).

Figure 4-1

Figure 4-1

Figure 4-1

-highlightcolor => color
Sets the color of the focus rectangle (shows when widget has focus).

Figure 4-1

Figure 4-1

Figure 4-1

-highlightthickness => amount
Sets the thickness of the highlight rectangle around the Button; indicates focus.

Figure 4-1

Figure 4-1

Figure 4-1

-image => $imgptr
$imgptr is a pointer to an Image object made with any supported image format. See Chapter 17, "Images and Animations" for details.

Figure 4-1

Figure 4-1

Figure 4-1

-indicatoron => 0 | 1
Determines whether to display the indicator.

 

Figure 4-1

Figure 4-1

-justify => 'left' | 'right' | 'center'
Sets the direction against which multiline text will justify.

Figure 4-1

Figure 4-1

Figure 4-1

-offvalue => newvalue
Sets the value used when the Button is off. Must be a scalar. Default is 0.

 

Figure 4-1

 
-onvalue => newvalue
Sets the value used when the Button is on. Must be a scalar. Default is 1.

Figure 4-1

 
-padx => amount
Adds extra space to the left and right side of the Button inside the Button edge.

Figure 4-1

Figure 4-1

Figure 4-1

-pady => amount
Adds extra space to the top and bottom of the Button inside the Button edge.

Figure 4-1

Figure 4-1

Figure 4-1

-relief =>'flat'|'groove'|'raised'|'ridge'|'sunken'|'solid'
Changes the type of edges drawn around the Button. Default for Checkbutton and Radiobutton is 'flat'.

Figure 4-1

Figure 4-1

Figure 4-1

-selectcolor => color
Sets the color of the indicator when on.

 

Figure 4-1

Figure 4-1

-selectimage => imgptr
Indicates the image to display instead of text when Button is on. Ignored if -image is not used.

 

Figure 4-1

Figure 4-1

-state => 'normal' | 'disabled' | 'active'
Indicates the Button's state of responsiveness. If set to 'disabled', the Button does not respond.

Figure 4-1

Figure 4-1

Figure 4-1

-takefocus => 0 | 1 | undef
Indicates that the Button will never get focus (0), always get focus (1), or let the application decide (undef).

Figure 4-1

Figure 4-1

Figure 4-1

-text => 'text'
Sets the text string displayed on the Button.

Figure 4-1

Figure 4-1

Figure 4-1

-textvariable => \$variable
Points to a variable containing text to be displayed in Button. Button text will change as $variable does.

Figure 4-1

Figure 4-1

Figure 4-1

-underline => n
Underlines the nth character in the text string. Allows keyboard input via that character when Button has the focus. It's important to note that the character is only underlined; any behavior must be supplied by the programmer via a bind command. See Chapter 15, "Anatomy of the MainLoop" for binding details.

Figure 4-1

Figure 4-1

Figure 4-1

-value => newvalue
Sets the value assigned to $variable (with -variable option) when this Radiobutton is selected. Default is 1.

   

Figure 4-1

-variable => \$value
Associates the on/off values with $variable.

 

Figure 4-1

Figure 4-1

-width => amount
Sets the width of the Button in characters if text is displayed and as a screen distance if an image or bitmap is displayed.

Figure 4-1

Figure 4-1

Figure 4-1

-wraplength => amount
Sets the screen distance for the maximum amount of text displayed on one line. The default is 0, which means that text is not wrapped at word boundaries, only at line breaks (newlines).

Figure 4-1

Figure 4-1

Figure 4-1






JavaScript EditorJavaScript Formatter     Perl Manuals


©