Leser: 1
5 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use warnings;
use strict;
use Tk;
my @data = qw(null eins zwei drei);
my @data_2 = qw(nil one two three);
my @display;
my $mw = MainWindow->new;
for my $i (1..3) {
push @display, $mw->Label(
-textvariable=>\$data[$i],
) ->pack;
}
my $toggle_button = $mw->Button(
-text=>"English!",
-command=>sub{ @data = @data_2},
)->pack;
MainLoop;
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
#!/usr/bin/perl
use strict;
use warnings;
use Tk;
my @data = qw(null eins zwei drei);
my @data_2 = qw(nil one two three);
my @display;
my $mw = MainWindow->new;
for my $i ( 1..scalar(@data) ) {
push @display, $mw->Label(
-textvariable=>\$data[$i],
) ->pack;
}
my $toggle_button = $mw->Button(
-text=>"English!",
-command=>sub{ for (my $i =1; $i<scalar(@data); $i++) {$data[$i] = $data_2[$i]} },
)->pack;
MainLoop;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use warnings;
use strict;
use Tk;
my @data = qw(null eins zwei drei);
my @data_2 = qw(nil one two three);
my @display;
my $mw = MainWindow->new;
for my $i (1..3) {
push @display, $mw->Label(
-textvariable=>\$data[$i],
) ->pack;
}
my $toggle_button = $mw->Button(
-text=>"English!",
-command=>sub{print \$data[1]; @data = @data_2; print \$data[1];},
)->pack;
MainLoop;
SCALAR(0x224fb8)SCALAR(0x2ba8064)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use warnings;
use strict;
use Tk;
my @data = qw(null eins zwei drei);
my @data_2 = qw(nil one two three);
my @display;
my $mw = MainWindow->new;
for my $i (1..3) {
push @display, $mw->Label(
-textvariable=>\$data[$i],
) ->pack;
}
my $toggle_button = $mw->Button(
-text=>"English!",
-command=>sub{print \$data[1]; for(0..scalar(@data) -1){$data[$_] = $data_2[$_]}; print \$data[1];},
)->pack;
MainLoop;
SCALAR(0x224fb8)SCALAR(0x224fb8)
5 Einträge, 1 Seite |