Leser: 2
|< 1 2 >| | 14 Einträge, 2 Seiten |
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
39
40
41
42
43
44
45
46
47
48
49
50
51
my $name = "Rajappa Iyer";
my $email = "rsi\@netcom.com";
my $os = "Linux";
use vars qw($top);
$top = MainWindow->new;
my $pb = $top->Button(-text => "Notebook", -command => \&donotebook);
$pb->pack;
MainLoop;
my $f;
sub donotebook {
if (not defined $f) {
# The current example uses a DialogBox, but you could just
# as easily not use one... replace the following by
# $n = $top->NoteBook(-ipadx => 6, -ipady => 6);
# Of course, then you'd have to take care of the OK and Cancel
# buttons yourself. :-)
$f = $top->DialogBox(-title => "Personal Profile",
-buttons => ["OK", "Cancel"]);
my $n = $f->add('NoteBook', -ipadx => 6, -ipady => 6);
my $address_p = $n->add("address", -label => "Address", -underline => 0);
my $pref_p = $n->add("pref", -label => "Preferences", -underline => 0);
$address_p->LabEntry(-label => "Name: ",
-labelPack => [-side => "left", -anchor => "w"],
-width => 20,
-textvariable => \$name)->pack(-side => "top", -anchor => "nw");
$address_p->LabEntry(-label => "Email Address:",
-labelPack => [-side => "left", -anchor => "w"],
-width => 50,
-textvariable => \$email)->pack(-side => "top", -anchor => "nw");
$pref_p->LabEntry(-label => "Operating System:",
-labelPack => [-side => "left"],
-width => 15,
-textvariable => \$os)->pack(-side => "top", -anchor => "nw");
$n->pack(-expand => "yes",
-fill => "both",
-padx => 5, -pady => 5,
-side => "top");
}
my $result = $f->Show;
if ($result =~ /OK/) {
print "name = $name, email = $email, os = $os\n";
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use Tk;
use Tk::NoteBook;
my $mw = new MainWindow;
my $nb = $mw->NoteBook()->pack();
my $page1 = $nb->add('PageID-1', -label => 'ReiterEins');
my $page2 = $nb->add('PageID-2', -label => 'ReiterZwei');
$page1->Label(-text => 'In Seite 1')->pack();
$page2->Label(-text => 'In Seite 2')->pack();
MainLoop();
$toplevel->geometry('200x400');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl -w
#init prog
use Tk;
use Tk::NoteBook;
$ENV{HOME} = "C:\\"; #define to request warnings in Tk.pm
my $mw = MainWindow -> new( -width => 800,
-height => 600);
my $nb = $mw->NoteBook() -> pack();
my $cardCustomer = $nb->add('data', -label => 'Kundendaten');
my $cardEmail = $nb->add('email', -label => 'Emailversand');
my $cardPost = $nb->add('post', -label => 'Postaufkleber');
$cardCustomer -> Label(-text => 'In Seite 1')->pack();
$cardEmail -> Label(-text => 'In Seite 2')->pack();
$cardPost -> Label(-text => 'In Seite 3')->pack();
MainLoop();
QuoteHm, es klappt nicht!
Das Fenster bleibt immer noch so groß, wie viel Platz die Widgets benötigen,
QuoteAch so, beim benutzen von
geometry gibt der Interpreter permanent Fehlermeldungen aus!
|< 1 2 >| | 14 Einträge, 2 Seiten |