3 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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
#!/usr/bin/perl use strict; use warnings; use Tk; my $text = ''; my $text2 = ''; my $rbv = ''; my $mw = tkinit; $mw->Entry( -textvariable => \$text )->pack; # fuege das Entry-Feld hinzu my $cb1 = $mw->Radiobutton( -text => 'Radiobutton1', -value => 1, -variable => \$rbv )->pack; my $cb2 = $mw->Radiobutton( -text => 'Radiobutton2', -value => 2, -variable => \$rbv )->pack; my $btn = $mw->Button( -text => 'Ok', -command => \&button_clicked )->pack; my $entry = $mw->Entry( -textvariable => \$text2 )->pack; MainLoop; sub button_clicked{ if( $rbv == 1 ){ fill_text1(); } elsif( $rbv == 2 ){ fill_text2(); } else{ $text2 = 'Fehler!'; } } sub fill_text1{ $text2 = 'Sie haben eingegeben: ' . $text; } sub fill_text2{ $text2 = 'Ihr Text: ' . $text; }
3 Einträge, 1 Seite |