The stylebutton widget
In Brief
Supports a number of button styles:
The -text option is supported from Version 0.09 and onwards.
Commands
::tclmacbag::stylebutton pathName ?Options?
Available options:
- -image imageName
The imageName should have been previously created by the Tk Photo package or equivalent.
If using the Tk Photo package itself for this purpose, it should be noted that the Tk 8.4 version doesn't handle
PNG format images well on the Mac platform. Try using GIF format or the TkPNG package.
- -background colourLabel
This optional option sets the colour of the area which appears visually outside the button but inside the button widget.
This colour can be any standard colour name or label, such as '#AABB00' or 'white'. If this option is not used, this colour
will default to the Tile theme's standard background colour (which, on Mac, maps to the pinstripe texture).
- -text String
Uses a text string instead of the image.
The -text option will override the use of -image if both are used in the one command.
The -text option is supported from Version 0.09 and onwards.
- -command Command
The command to be executed when the button is clicked.
- -style pill|chrome|steel|simple|gel|gel-small|safari|clearcap|mail|capsule
The name of the button decoration style to be used.
For buttons arranged together, specifiy the location in the style. Eg: 'pill-left', 'capsule-middle', 'safari-right', and so on.
Style fashions change quite a bit in the Mac world. The 'safari' style is probably the most in vogue at the moment.
- -state State
Available values: normal or disabled.
- -force yes
Force the widget to use Mac style, even if the OS platform isn't a Mac.
Example
::tclmacbag::stylebutton .f.b1 -background #B2B2B2 -image $img \
-style steel-left -command {puts Test} -force yes
Further Information
Supports the
-force yes option to enable the Mac versions of the widget to be used on non-Mac platforms
(as seen in the above screenshot from an ancient copy of Windows 98).
Without -force yes used, widgets appear on non-Mac platforms as standard Tile/Ttk buttons.
Images with this widget should be 13 pixels high and (usually but not always) 13 pixels in width.
By strong convention, icon images should be dark coloured greyscale, with a transparent background. (This reflects the history of this button class in the Mac OS range before OS X.)
The exception to this rule is the 'mail' style (named for Apple's Mail.app) which uses colour icons.