G'day PerlCowboy,
All (I can't think of any exceptions off the top of my head) Tk widget options start with a "-". See your first post here for a plethora of examples.
All widget documentation is laid out in much the same manner. Looking at Tk::Button, you'll see Standard Options followed by Widget-Specific Options.
The Standard Options are just a list. Their details can be found in Tk::options. At the start of that page, you'll find the cget() and configure() methods: these are what you use to query and change options (both Standard and Widget-Specific ones).
It's unclear precisely what you want to do. If you just want to change the default background colour for your GUI when it's first presented, then ++roboticus is quite correct, you don't include them in a sub; instead, you'll want code like this:
$parent->Button( -text => '...', -background => '...', -command => ... )
If, however, you want a colour to change in response to an event (e.g. a button press), then you will want code in a sub, but using the configure() method I indicated above.
— Ken
In reply to Re: Change button color with Tk
by kcott
in thread Change button color with Tk
by PerlCowboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |