You can prevent the callback from being triggered by setting the variable to the first item of @newoptions before changing the options.
sub change_ops { my $op = shift; my $var = $op->cget('-textvariable'); my @newoptions = map { ++$. } ( 0 .. 3 ); my ($prev) = (grep {$_ eq $$var} @newoptions) || ''; $$var = $newoptions[0]; $op->configure( -options => \@newoptions ); $$var = $prev; }
In reply to Re: Setting options in Tk::Optionmenu without the callback?
by Anonymous Monk
in thread Setting options in Tk::Optionmenu without the callback?
by graff
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |