Thread Fortschrittsbalken: Perl-TK (39 answers)
Opened by Gast at 2003-09-02 12:59

Robby
 2003-09-03 10:19
#42185 #42185
User since
2003-08-11
409 Artikel
BenutzerIn
[default_avatar]
[quote=Schlampie,02.09.2003, 14:45]Ich will doch nur den Code!!!!!![/quote]
Entweder

Code: (dl )
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
43
44
45
use Tk;

my $mw = MainWindow->new;

my $c = $mw->Canvas(qw/-width 200 -height 60 -background white/)->grid;

my $w = 100;
my $h = 20;

my $i = $c->Photo(-width => $w, -height => $h);
$c->createImage(100, 30, -image => $i);

$i->put('#6363ce', -to => 0, 0, 2, $h);
$i->put( [
'#6363ce', '#6363ce',
'#9c9cff', '#9c9cff',
'#ceceff', '#ceceff',
'#efefef', '#efefef',
'#efefef', '#efefef',
'#efefef', '#efefef',
'#efefef', '#efefef',
'#efefef', '#efefef',
'#efefef', '#efefef',
'#efefef', '#efefef',
], -to => 2, 0, 4, $h);


for (my $col = 4; $col < $w; $col++) {
$i->put([
'#30319d', '#30319d',
'#6563cd', '#6563cd',
'#ceceff', '#ceceff',
'#ceceff', '#ceceff',
'#ceceff', '#ceceff',
'#ceceff', '#ceceff',
'#ceceff', '#ceceff',
'#ceceff', '#ceceff',
'#ceceff', '#ceceff',
'#ceceff', '#ceceff',
], -to => $col, 0, $col + 1, $h);
$mw->update;
$mw->after(25);
}

MainLoop;


oder

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use Tk;
use Tk::ProgressBar;

my $mw = MainWindow->new(-title => 'ProgressBar example');

$progress = $mw->ProgressBar(
-width => 30,
-from => 0,
-to => 100,
-blocks => 50,
-colors => [0, 'green', 50, 'yellow', 80, 'red'],
-variable => \$percent_done
)->pack(-fill =>'x');

$mw->Button(-text =>'Go', command => sub {
for ($i=0; $i<1000;$i++) {
$percent_done = $i/10;
print "$i\n";
$mw->update;
}
})->pack(-side =>'bottom');

MainLoop;



2teres ist wohl hübscher.... :)

Viel Spaß damit!
Kaum macht man es richtig - schon funktioniert es!

View full thread Fortschrittsbalken: Perl-TK