in reply to Configure default widget options in Tk

You might want to checkout optionAdd and "perldoc Tk::options".
#!/usr/bin/perl -w use strict; use Tk; my $mw=tkinit; $mw->optionAdd("*background"=>'lightblue','userDefault'); $mw->Listbox->pack->insert(0,qw/a listbox/); $mw->Text->pack->insert('1.0','text widget'); $mw->Entry->pack->insert(0,'entry widget'); MainLoop;

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: Configure default widget options in Tk
by hangon (Deacon) on Jan 19, 2009 at 20:36 UTC

    Thanks zentara. Actually I found optionAdd under "perldoc Tk:option" (not plural). Usage wasn't exactly intuitive or clear, but I came up with the following which does what I want - sets default values for buttons without affecting any other type of widget.

    $mw->optionAdd('*Button.font', '{Arial} 14 {bold}', 'userDefault'); $mw->optionAdd('*Button.padX', '2', 'userDefault'); $mw->optionAdd('*Button.padY', '2', 'userDefault');