Tk::Optionmenu is derived from Tk::Menubutton and probably has support for configuring most, if not all, of its options.
The documentation is somewhat brief and possibly ambiguous in terms of making a clear distinction between options of the widget (e.g. $w->configure($option => $val); and options of the menu (e.g. $w->addOptions([@new_options]);).
Try this example code:
#!perl use 5.12.0; use warnings; use Tk; use Tk::Optionmenu; my $mw = MainWindow->new(); my $om = $mw->Optionmenu( -options => [qw{Zero One Two Three}], )->pack(); my $state = 0; my @states = qw{normal disabled}; $mw->Button(-text => q{Toggle State}, -command => sub { $state ^= 1; $om->configure(-state => $states[$state]); })->pack(); $mw->Button(-text => q{Exit}, -command => sub { exit })->pack(); MainLoop;
-- Ken
In reply to Re^2: optionmenu configure problem in perl tk
by kcott
in thread optionmenu configure problem in perl tk
by vr786
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |