Leser: 1
6 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Hosteingabe
$frame11->Label(-text=> "Datenbankhost: ")->pack();
$host = $frame11->Entry(-width=> "15")->pack();
# Usereingabe
$frame11->Label(-text=> "User: ")->pack();
$user = $frame11->Entry(-width=> "15")->pack();
# Passworteingabe
$frame11->Label(-text=> "Passwort: ")->pack();
$passwd = $frame11->Entry(-width=> "15")->pack();
# Verbinden
$frame11->Button(-text=> "Verbinden")->pack();
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
#!/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) = ("","","");
$mw -> LabEntry ( -label => "Datenbankhost: " ,
-labelPack => [ -side => "left" ] ,
-textvariable => \$dbhost ,
-background => "white" )
-> pack ( -anchor => "w" );
$mw -> LabEntry ( -label => "User: " ,
-labelPack => [ -side => "left" ] ,
-textvariable => \$user ,
-background => "white" )
-> pack ( -anchor => "w" );
$mw -> LabEntry ( -label => "Passwort: " ,
-labelPack => [ -side => "left" ] ,
-textvariable => \$passwd ,
-background => "white" )
-> pack ( -anchor => "w" );
# verbinden button erstellen
$mw -> Button ( -text => "Verbinden" ,
-command => sub { print("DBHost: $dbhost\nUser: $user\nPassword: $passwd\n") } )
-> pack ( );
MainLoop;
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 '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;
6 Einträge, 1 Seite |