Leser: 22
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/usr/bin/perl use strict; use warnings; use threads; use Tk; my $thread = threads->create( \&search_file ); $thread->detach; my $mw = tkinit(); $mw->Label( -text => 'hallo' )->pack; MainLoop; sub search_file { for my $counter ( 1 .. 10 ) { print $counter,"\n"; sleep 1; } }
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
#!/usr/bin/perl
use strict;
use warnings;
use threads;
use threads::shared;
use Tk;
my $xxx:shared='';
my $thread = threads->create( \&search_file );
$thread->detach;
my $mw = tkinit();
$mw->Label( -text => 'hallo' )->pack;
$mw->Entry( -textvariable => \$xxx )->pack;
MainLoop;
sub search_file {
my $counter = 0;
for (;;) {
$counter++;
$xxx = $counter;
sleep 1;
}
}