#!/usr/bin/perl use strict; use warnings 'all'; use Tk; use Tk::LabEntry; # Frame erstellen(hier MainWindow als Frame Ersatz) my $mw = tkinit(); # erstellen der (Text-)Eintragsfelder my($dbhost, $user, $passwd) = ("","",""); my $i = 0; foreach (["Datenbankhost: ", \$dbhost], ["User: ", \$user], ["Passwort: ", \$passwd]) { $mw -> Label ( -text => $_->[0] , -anchor => "w" ) -> grid ( -row => $i , -column => 0 , -sticky => "ew" ); $mw -> Entry ( -textvariable => $_->[1] , -background => "white" ) -> grid ( -row => $i++ , -column => 1 ); } # erstellen des verbinden buttons $mw -> Button ( -text => "Verbinden" , -command => sub { print("DBHost: $dbhost\nUser: $user\nPassword: $passwd\n") } ) -> grid ( -row => $i , -column => 0 , -columnspan => 2 , -ipadx => 15 , -pady => 2 ); MainLoop;