Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: optionmenu configure problem in perl tk

by kcott (Archbishop)
on Nov 08, 2010 at 13:21 UTC ( [id://870105]=note: print w/replies, xml ) Need Help??


in reply to Re: optionmenu configure problem in perl tk
in thread optionmenu configure problem in perl tk

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://870105]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2025-11-09 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (65 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.