Thread Perl TK - Programm (34 answers)
Opened by betterworld at 2003-10-26 00:14

BrownWolf
 2003-10-26 02:42
#44674 #44674
User since
2003-08-15
308 Artikel
BenutzerIn
[default_avatar]
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 &#36counter;
my &#36myvar = "Du hast den Button schon 0 mal gedrückt.";
my &#36win = MainWindow->new;
my &#36text = &#36win->Label(-textvariable => \&#36myvar);
my &#36button = &#36win->Button(
               
           -text => "Klicke hier",
               
           -command => sub {
               
               
++&#36counter;
               
               
&#36myvar = "Du hast den Button schon &#36counter mal gedrückt.";
               
           }
               
          );
&#36text->pack();
&#36button->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 &#36counter;
my &#36myvar = "Der Zähler steht momentan auf 0.";
my &#36win = MainWindow->new(-background => "#000000");
&#36win->title("Zählerprogramm");
my &#36text = &#36win->Label(-foreground => "white", -background => "#000000", -textvariable => \&#36myvar);
my &#36button = &#36win->Button(-text => "+", -foreground => "white", -background => "#000088", -command => sub { handler(1) });
my &#36button2 = &#36win->Button(-text => "-", -foreground => "white",  -background => "#000088", -command => sub { handler(2) });
&#36text->pack();
&#36button->pack(-side => "left");
&#36button2->pack(-side => "right");
MainLoop;

sub handler {
    my &#36option = shift;
    &#36option == 1 ? ++&#36counter : --&#36counter;
    &#36myvar = "Der Zähler steht momentan auf &#36counter.";
}
\n\n

<!--EDIT|BrownWolf|1067123198-->
Code (perl): ()
1
2
3
sub _{s;;xrqIpiql\\{}p{pl{R>rl{N{}gjwpkssq]>rl{N;;;*{{}=*{_};;
&#36{{}={q{{{}}}=>[reverse+split+reverse+q;}{;]};&#36{{}->{q{{{}}}}->[@{{}];}
&#36{{}=reverse+_(q{{}}=>q{{}})^chr(30)x+length&_(q{{}}=>,q{{}})and+print;

View full thread Perl TK - Programm