in reply to Tk and optionAdd's scope

Here's my stab at it:
#!/usr/bin/perl use strict; use warnings; use Tk; require Tk::LabFrame; require Tk::LabEntry; my $mw = MainWindow->new; $mw->geometry("150x80"); #$mw->optionAdd( "LabFrame.font", "helvb12" ); my $canvas_total = "Label Test"; my $le_t_text = "LabFrame Test"; my $le = $mw->LabEntry( -textvariable => \$canvas_total, -labelVariable => \$le_t_text, -labelPack => [ -anchor => "center" ] ); $le->pack( -expand => 1, -fill => "y" ); #print STDERR $le->optionGet( "font", ref $le ), "\n"; MainLoop;
I used the labelpack example from the source as a starting point. Note that I commented out the optionAdd because it didn't make any difference. Also the print statement.

Replies are listed 'Best First'.
Re^2: Tk and optionAdd's scope
by eff_i_g (Curate) on Apr 16, 2010 at 14:21 UTC
    This works because LabFrames are bold by default. In my example I'm changing the default font at a global level:
    $mw->optionAdd('*font', 'helvr12');
    As a result the LabFrame's are no longer bold and I'm trying to revert them.
      I understand. I went as far as I could without having to modify my own option database setup. You should probably try Tk::Xrm.