davide_c has asked for the wisdom of the Perl Monks concerning the following question:
according to#!/usr/bin/perl use strict; use warnings; use Tkx; my $mw = Tkx::widget->new("."); my $menu = $mw->new_menu; my $M_file = $menu->new_menu( -name => "file", -tearoff => 0, ); my $UUU=$menu->add_cascade( -label => "File", -underline => 0, -menu => $M_file, -state=>'normal', ); $M_file->add_command( -label => "New", -underline => 0, -command => \&new, ); $M_file->add_command( -label => "Exit", -underline => 1, -command => [\&Tkx::destroy, $mw], ); my $help = $menu->new_menu( -name => "help", -tearoff => 0, ); $menu->add_cascade( -label => "Help", -underline => 0, -menu => $help, ); $help->add_command( -label => "\uManual", -command => \&show_manual, ); $mw->configure(-menu => $menu); my $button_test= $mw->new_ttk__button(-text => "test", -command => \&t +st1); $button_test->g_grid(-column => 0, -row => 0, -sticky => "ew"); &Tkx::MainLoop(); exit; sub tst1 { my $st = $UUU->cget(-state); $st eq 'normal' ? $UUU->configure(-state =>'disabled') : $UUU->confi +gure(-state =>'normal'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tkx disabling/enabling menus (wot)
by Anonymous Monk on May 21, 2015 at 00:33 UTC |