Leser: 19
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
#!/usr/bin/perl use strict; use Tk; my $haupt = new MainWindow; my $links= $haupt->Frame(); $links->Label (-text => "Betrag in DM:")->pack(); my $dm = $links->Entry(); $dm->pack(); my $schalter = $links->Button (-text => "Berechnung", -command => \&abrechnung)->pack(); my $schalter2 = $links->Button (-text => "Beenden", -command=>[$haupt => 'destroy']) ->pack (-pady => "20"); my $rechts= $haupt ->Frame(); $rechts->Label (-text =>"Betrag in Euro:")->pack(); my $daten = $rechts -> Listbox(); $daten->pack(); $links ->pack (-side =>"left"); $rechts ->pack (-side =>"right"); MainLoop (); sub berechnung { my $dm_sub = $dm ->get; my $euro = 0; $euro = $dm_sub / 1.95583; $daten->insert ('end', " ". $euro ); }
1
2
3
4
5
6
7
Tk::Error Undefined subroutine &main::abrechnung called at c:/perl/site/lib/Tk.
pm line 250.
Tk callback for .frame.button
Tk::_ANON_at c:/perl/site/lib/Tk.pm line 250
Tk::Button::butUp at c:/perl/site/lib/Tk/Button.pm line 175
<ButtonRelease-1>
<command bound to event>
MainLoop();