home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _57bc1607c4fa0795c7eed6bda37d8e42 < prev    next >
Encoding:
Text File  |  2004-06-01  |  1.4 KB  |  44 lines

  1. # labels.pl
  2.  
  3. use vars qw/$TOP/;
  4.  
  5. sub labels {
  6.  
  7.     # Create a top-level window that displays a bunch of labels.  @pl is the
  8.     # "packing list" variable which specifies the list of packer attributes.
  9.  
  10.     my($demo) = @_;
  11.     $TOP = $MW->WidgetDemo(
  12.         -name     => $demo,
  13.         -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.',
  14.         -title    => 'Label Demonstration',
  15.         -iconname => 'label',
  16.     );
  17.  
  18.     my(@pl) = qw/-side left -expand yes -padx 10 -pady 10 -fill both/;
  19.     my $left = $TOP->Frame->pack(@pl);
  20.     my $right = $TOP->Frame->pack(@pl);
  21.  
  22.     @pl = qw/-side top -expand yes -pady 2 -anchor w/;
  23.     my $left_l1 = $left->Label(-text => 'First label')->pack(@pl);
  24.     my $left_l2 = $left->Label(
  25.         -text   => 'Second label, raised just for fun',
  26.         -relief => 'raised',
  27.     )->pack(@pl);
  28.     my $left_l3 = $left->Label(
  29.         -text   => 'Third label, sunken',
  30.         -relief => 'sunken',
  31.     )->pack(@pl);
  32.  
  33.     @pl = qw/-side top/;
  34.     my $right_bitmap = $right->Label(
  35.         -image       => $TOP->Photo(-file => Tk->findINC('Xcamel.gif')),
  36.         -borderwidth => 2,
  37.     -relief      => 'sunken',
  38.     )->pack(@pl);
  39.     my $right_caption = $right->Label(-text => 'Perl/Tk')->pack(@pl);
  40.  
  41. } # end labels
  42.  
  43. 1;
  44.