use Tk; $window = MainWindow->new(-width=> '0m',-title=> 'Umrechnung'); $oben = $window->Frame->pack(); $titel = $oben->Label(-text=>"Programm für die Umrechnung von Grad Celsius in Kelvin und Fahrenheit.")->pack(); $clean = $window->Frame->pack(); $empty = $clean->Label(-text=>"")->pack(); $window->Label(-text=>'Anfangswert:')->pack(); $eingabe = $window->Text(-width=>20,-height=>1,-borderwidth=> '1m',-cursor=> 'left_side',-background=> 'white',-font=>'courierb12', -foreground=> 'black')->pack(); $window->Label(-text=>'Endwert:')->pack(); $eingabe2 = $window->Text(-width=>20,-height=>1,-borderwidth=> '1m',-cursor=> 'left_side',-background=> 'white',-font=>'courierb12', -foreground=> 'black')->pack(); $clean2 = $window->Frame->pack(); $empty2 = $clean2->Label(-text=>"")->pack(); $window->Label(-text=>'Celsius Fahrenheit Kelvin', -font=>'courierb 10 bold' )->pack(); $ausgabe = $window->Text(-width=>60,-height=>10,-borderwidth=> '0m',-cursor=> 'left_side',-background=> 'white',-font=>'courierb 12', -foreground=> 'black')->pack(); $bottom_frame = $window->Frame()->pack(-side=>'bottom', -pady=>10); $bottom_frame->Button( -text=>'Alles zeigen', -command=>\&rechnen)->pack(-side=>'left'); $bottom_frame->Button( -text => "Alles löschen", -command=>\&loeschen)->pack(-side=>'left'); $bottom_frame->Button( -text => "Beenden", -command=> sub {exit 0})->pack(-side=>'left'); MainLoop; sub rechnen { my $anfang = $eingabe->Contents; my $k = (($anfang * 9) /5 ) +32; my $f = $anfang + 273.15; $ausgabe->Contents("Fahrenheit: $k\nKelvin: $f"); } sub loeschen { $ausgabe->Contents(''); }