Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | ||
3 | sub mkLabel { | |
4 | ||
5 | # Create a top-level window that displays a bunch of labels. | |
6 | ||
7 | $mkLabel->destroy if Exists($mkLabel); | |
8 | $mkLabel = $top->Toplevel(); | |
9 | my $w = $mkLabel; | |
10 | dpos($w); | |
11 | $w->title('Label Demonstration'); | |
12 | $w->iconname('Labels'); | |
13 | ||
14 | my $w_msg = $w->Message(-font => '-Adobe-times-medium-r-normal--*-180-*-*-*-*-*-*', -aspect => 300, | |
15 | -text => 'Five labels are displayed below: three textual ones on the left, and a bitmap label ' . | |
16 | 'and a text label on the right. Labels are pretty boring because you can\'t do anything with ' . | |
17 | 'them. Click the "OK" button when you\'ve seen enough.'); | |
18 | my $w_left = $w->Frame(); | |
19 | my $w_right = $w->Frame(); | |
20 | my $w_ok = $w->Button(-text => 'OK', -command => ['destroy', $w], -width => 8); | |
21 | $w_msg->pack(-side => 'top'); | |
22 | $w_ok->pack(-side => 'bottom'); | |
23 | my(@pl) = (-side => 'left', -expand => 'yes', -padx => 10, -pady => 10, -fill => 'both'); | |
24 | $w_left->pack(@pl); | |
25 | $w_right->pack(@pl); | |
26 | ||
27 | my $w_left_l1 = $w_left->Label(-text => 'First label'); | |
28 | my $w_left_l2 = $w_left->Label(-text => 'Second label, raised just for fun', -relief => 'raised'); | |
29 | my $w_left_l3 = $w_left->Label(-text => 'Third label, sunken', -relief => 'sunken'); | |
30 | @pl = (-side => 'top', -expand => 'yes', -pady => 2, -anchor => 'w'); | |
31 | $w_left_l1->pack(@pl); | |
32 | $w_left_l2->pack(@pl); | |
33 | $w_left_l3->pack(@pl); | |
34 | ||
35 | my $w_right_bitmap = $w_right->Label(-bitmap => '@'.Tk->findINC('demos/images/face'), -borderwidth => 2, | |
36 | -relief => 'sunken'); | |
37 | my $w_right_caption = $w_right->Label(-text => 'Tcl/Tk Proprietor'); | |
38 | $w_right_bitmap->pack(-side => 'top'); | |
39 | $w_right_caption->pack(-side => 'top'); | |
40 | ||
41 | } # end mkLabel | |
42 | ||
43 | ||
44 | 1; |