Optionmenu is derived from Menubutton which has the -indicatoron option to show or hide that 'button'. Unfortunately, the author of Optionmenu decided to hardcode the state of -indicatoron to true in the Optionmenu Populate sub. That means you can not change the configuration as it is being constructed, (unless you build your own widget or override the Populate sub). You CAN however, easily change the state after it has been built.
use warnings; use strict; use Tk; my $mw = MainWindow->new(); my ( $var, $tvar ); my $opt = $mw->Optionmenu( -options => [ [ jan => 1 ], [ feb => 2 ], [ mar => 3 ], [ apr => 4 ], [ may => 5 ], [ jun => 6 ], [ jul => 7 ], [ aug => 8 ] ], -command => sub { print "got: ", shift, "\n" }, -variable => \$var, -textvariable => \$tvar, )->pack; # Now reconfigure the indicator button $opt->configure( -indicatoron => 0 ); MainLoop;
In reply to Re: Tk - how to alter appearance of Option Menu
by thundergnat
in thread Tk - how to alter appearance of Option Menu
by merrymonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |