File: menubug

package info (click to toggle)
perl-tk 1:800.025-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,444 kB
  • ctags: 19,081
  • sloc: ansic: 206,740; perl: 40,187; makefile: 4,371; sh: 2,373; yacc: 762
file content (28 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/local/bin/perl -w
use Tk;
use strict;

my $TOP = MainWindow->new;

my @menubuttons;
foreach (qw/right/) {
    my $pos = ucfirst;
    my $menubutton = $TOP->Menubutton(qw/-underline 0 -relief raised/,
				      -text => $pos, -direction => $_);
    push @menubuttons, $menubutton;
    my $menu = $menubutton->menu(qw/-type menubar -tearoff 0/);
    $menubutton->configure(-menu => $menu);
    $menubutton->command(-label => "$pos menu: first item", -command =>
			 sub {print "You selected the first item from the $pos menu.\n"});
$menubutton->command(-label => "$pos menu: second item", -command =>
    sub {print "You selected the second item from the $pos menu.\n"});
}
$menubuttons[0]->grid(qw/-row 0 -column 1 -sticky n/);

MainLoop;

__END__
==========================================================================
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu