#!/usr/bin/perl -w
use Tk;
use strict;
my $mw = MainWindow->new;
$mw->packPropagate(0);
$mw->optionAdd("*Button.Background", "red");
print "ARGV=@ARGV.\n";
my $l1 = $mw->Label(-text =>
"Application class/name is\n'" . $mw->class . '/' . $mw->name . "'
+");
$l1->pack;
my $b1 = $mw->Button(-background => 'yellow')->pack;
my $b2 = $mw->Button->pack;
my $b3 = $mw->Button('Name' => 'B3')->pack;
foreach ($mw->children) {
next if ref $_ eq 'Tk::Label';
$_->configure(-text => "'" . $_->PathName . "'");
}
MainLoop;
Run this with and without the $mw->optionAdd line to see the effect.
--Bob Niederman, http://bob-n.com
|