Hi. First off, always try to make a complete working example, so we don't have to flesh out your code to test it ourselves.
I'm not sure if you want 3 Optionmenus, with only 1 active, OR you want a single Optionmenu, in which you can change it's options dynamically based on the Entry callback. You might look at Setting options in Tk::Optionmenu without the callback?
I don't know if you are aware of it, but the Optionmenu widget's "options" array setting can be dynamically changed. A simple example:
If you really want to have a bunch of disabled Optionmenus laying around, it's your choice, but post a more complete example.#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); my @opt1 = ('a'..'m'); my @opt2 = ('n'.. 'z'); my $var = 'a'; my $tvar = 'a'; my $opt = $mw->Optionmenu( -command => \&show_choice, -variable => \$var, -textvariable => \$tvar, -options => \@opt1, )->pack; $mw->Button(-text=>'Change Options',-command=>[\&change_ops, $opt])->p +ack; $mw->Button(-text=>'Exit', -command=>sub{$mw->destroy})->pack; MainLoop; sub show_choice { print "got: ", shift, "\n" } sub change_ops { my $op = shift; $tvar = 'n'; $op->configure( -options => \@opt2 ); }
In reply to Re: Optionmenu Variable in Name
by zentara
in thread Optionmenu Variable in Name
by shortyfw06
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |