Name

button

button pathName [option value...]

The button command creates a new button widget named pathname.

Standard Options

-activebackground

-activeforeground

-anchor

-background

-bitmap

-borderwidth

-cursor

-disabledforeground

-font

-foreground

-highlightbackground

-highlightcolor

-highlightthickness

-image

-justify

-padx

-pady

-relief

-takefocus

-text

-textvariable

-underline

-wraplength

 

Widget-Specific Options

-command tclCommand (command, Command)

Command to be evaluated when button is invoked.

-default state (default, Default)

State for the default ring, a platform-dependent border drawn around the button to indicate it is the default button. Must be normal (button is not the default), active (button is the default), or disabled (no ring is drawn).

-height height (height, Height)

Desired height, in lines for text content or in screen units for images and bitmaps.

-state state (state, State)

State of the button. State must be normal, active, or disabled.

-width width (width, Width)

Desired width, in characters, for text content, or in screen units, for images and bitmaps.

Methods

pathName flash

Flash button by alternating between active and normal colors.

pathName invoke

Invoke the Tcl command associated with the button and return its result. An empty string is returned if there is no command associated with the button. This command is ignored if the button’s state is disabled.

Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.