summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/Tk/demos/widget_lib/labels.pl
blob: 4650ffdfd501c8c7a1382686a78d8fbe637d357a (plain)
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
# labels.pl

use vars qw/$TOP/;

sub labels {

    # Create a top-level window that displays a bunch of labels.  @pl is the
    # "packing list" variable which specifies the list of packer attributes.

    my($demo) = @_;
    $TOP = $MW->WidgetDemo(
        -name     => $demo,
        -text     => 'Five labels are displayed below: three textual ones on the left, and an image label and a text label on the right.  Labels are pretty boring because you can\'t do anything with them.',
        -title    => 'Label Demonstration',
        -iconname => 'label',
    );

    my(@pl) = qw/-side left -expand yes -padx 10 -pady 10 -fill both/;
    my $left = $TOP->Frame->pack(@pl);
    my $right = $TOP->Frame->pack(@pl);

    @pl = qw/-side top -expand yes -pady 2 -anchor w/;
    my $left_l1 = $left->Label(-text => 'First label')->pack(@pl);
    my $left_l2 = $left->Label(
        -text   => 'Second label, raised just for fun',
        -relief => 'raised',
    )->pack(@pl);
    my $left_l3 = $left->Label(
        -text   => 'Third label, sunken',
        -relief => 'sunken',
    )->pack(@pl);

    @pl = qw/-side top/;
    my $right_bitmap = $right->Label(
        -image       => $TOP->Photo(-file => Tk->findINC('Xcamel.gif')),
        -borderwidth => 2,
	-relief      => 'sunken',
    )->pack(@pl);
    my $right_caption = $right->Label(-text => 'Perl/Tk')->pack(@pl);

} # end labels

1;