Thread Perl TK - Programm
(34 answers)
Opened by betterworld at 2003-10-26 00:14
So bestimmt:
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 24 25 26 #!/usr/bin/perl -w use strict; use Tk; my $counter; my $myvar = "Du hast den Button schon 0 mal gedrückt."; my $win = MainWindow->new; my $text = $win->Label(-textvariable => \$myvar); my $button = $win->Button( -text => "Klicke hier", -command => sub { ++$counter; $myvar = "Du hast den Button schon $counter mal gedrückt."; } ); $text->pack(); $button->pack(); MainLoop; Edit: Mein erstes Zählerprogramm. Ist doch klasse geworden, oder ;) Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #!/usr/bin/perl -w use strict; use Tk; my $counter; my $myvar = "Der Zähler steht momentan auf 0."; my $win = MainWindow->new(-background => "#000000"); $win->title("Zählerprogramm"); my $text = $win->Label(-foreground => "white", -background => "#000000", -textvariable => \$myvar); my $button = $win->Button(-text => "+", -foreground => "white", -background => "#000088", -command => sub { handler(1) }); my $button2 = $win->Button(-text => "-", -foreground => "white", -background => "#000088", -command => sub { handler(2) }); $text->pack(); $button->pack(-side => "left"); $button2->pack(-side => "right"); MainLoop; sub handler { my $option = shift; $option == 1 ? ++$counter : --$counter; $myvar = "Der Zähler steht momentan auf $counter."; } <!--EDIT|BrownWolf|1067123198--> Code (perl): ()
1 2 3 sub _{s;;xrqIpiql\\{}p{pl{R>rl{N{}gjwpkssq]>rl{N;;;*{{}=*{_};; ${{}={q{{{}}}=>[reverse+split+reverse+q;}{;]};${{}->{q{{{}}}}->[@{{}];} ${{}=reverse+_(q{{}}=>q{{}})^chr(30)x+length&_(q{{}}=>,q{{}})and+print; |