in reply to How Can My Perl/Tk Program use a Defined Font for All Widgets?
I didn't know about the $mw->optionAdd('*font' => 'sans 12'); method, ++ tybalt89.
What I have been doing is to use fontCreate() to create a font for the main window then add that font to the options hashes that I apply when creating widgets.
my $mwFont = $mainWin->fontCreate( q{mwFont}, -family => q{courier}, -size => 10, ); $commonLabelOpts{ -font } = $mwFont; $commonButtonOpts{ -font } = $mwFont; $commonRadioButtonOpts{ -font } = $mwFont; ... $controlButtonFrame->Button( %commonButtonOpts, -text => q{Quit}, ...
The optionAdd() method seems simpler so I will most likely use it for new code.
Update: Changed example to correct the senior moment of choosing a widget without fonts ... what a dummy :-/
Cheers,
JohnGG
|
|---|