in reply to TK menu question

I think this is what you want (specifically line 6).
my %tk; $tk{top} = MainWindow->new(); $tk{menubar} = $tk{top}->Menu; $tk{top}->configure( -menu => $tk{menubar} ); $tk{menu_file} = $tk{menubar}->cascade( -label => '~File' ); $tk{menu_exit} = $tk{menubar}->command( -label => '~Exit', -command = +> sub { Tk::exit(0); } );
Updated: Changed "my $tk;" to "my %tk;"

Replies are listed 'Best First'.
Re^2: TK menu question
by hebes_99 (Acolyte) on Jan 30, 2006 at 15:34 UTC
    Am I missing something obvious? When I run the above code, nothing happens (no window creation, etc). I added use Tk; to the code. Still nothing. This looks like a much better way to go...if I can get it to work....thoughts? Neevvveeerrrrmind..... forgot MainLoop()....
      My apologies for the confusion. The first few lines are there just so that readers can understand the variables I'm using. it wasn't meant to be a fully working code sample.