File: menubug

package info (click to toggle)
perl-tk 1%3A804.035-0.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 35,068 kB
  • sloc: ansic: 349,547; perl: 52,290; sh: 17,904; makefile: 5,732; asm: 3,565; ada: 1,681; pascal: 1,089; cpp: 1,006; yacc: 883; cs: 879
file content (42 lines) | stat: -rwxr-xr-x 1,433 bytes parent folder | download | duplicates (8)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/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

The same problem can be reproduced with original Tk8.4 and Tk8.5:

menubutton .mb -text test
pack .mb 
menu .mb.menu -type menubar
.mb configure -menu .mb.menu

$ wish8.4 /tmp/menubug.tk 
Tk_MoveToplevelWindow called with non-toplevel window
zsh: 32762 abort (core dumped)  wish8.4 /tmp/menubug.tk

It is reported as 
https://sourceforge.net/tracker2/?func=detail&aid=2160206&group_id=12997&atid=112997