Thread Menubar ändern (8 answers)
Opened by Mako at 2007-12-06 13:11

styx-cc
 2007-12-07 13:05
#103552 #103552
User since
2006-05-20
533 Artikel
BenutzerIn

user image
Schon mit "configure probiert"?
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl -w
use strict;
use Tk;

my $mw = MainWindow->new(-title=>"Test");

my $toplevel = $mw->toplevel;
my $menubar = $toplevel->Menu(-type => 'menubar');
$toplevel->configure(-menu => $menubar);

my $datei = $menubar->cascade(-label => '~Datei',
                              -tearoff => 0);
my $n = $datei->command(-label => 'Neu', -command => \&neu);
my $o = $datei->command(-label => 'Öffnen', -command => \&open);

$mw->Button(-text=>'Change Text',-command => sub {&change_text} )->pack;

MainLoop;

sub change_text {
  $n->configure(-label => 'New');
  $o->configure(-label => 'Open');
}
Pörl.

View full thread Menubar ändern