Thread Label-Größe & Textänderung: Größe halten (16 answers)
Opened by pktm at 2005-01-16 17:58

format_c
 2005-01-16 19:05
#42780 #42780
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Benutze -textvariable
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use strict;
use Tk;
my $i = 0;
my $labeltext = '';
my $mw = MainWindow->new(-title=>'Labeltest');
$mw->minsize(500,200);
$mw->Label(-textvariable=>\$labeltext,-background=>'red')->pack(-fill=>'both');
$mw->Button(-text=>'Verändere Text',-command=>\&veraendere_text)->pack();
$mw->Button(-text=>'Quit',-command=>sub{$mw->destroy();})->pack();

MainLoop;

sub veraendere_text () {
my @text = qw/Labeltext1 Labeltext2 Text3 etc/;
$labeltext = @text[$i];
$i = 0 if $i++ >= 3;

}


Gruß Alex

View full thread Label-Größe & Textänderung: Größe halten