Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
As another monk mentioned, you can create the widgets, place them into an array and then apply geometry management to the array elements, but the packer is really a particularly simple case — the other geometry managers end up needing more information, often unique to each widget. As for -background => 'cyan', Tk offers an "options database" that uses something similar to app-defaults values and the options database should be used in preference to hardcoded color schemes. I am still learning how to use this and would appreciate any help other monks can provide for all here, but here are some bits from a program I am working on: (partially developed; partially tested; this is from the program I mentioned in POE::Filter for Tor control protocol)
$Bin/app-defaults:
So far, I have had no trouble applying defaults from an options file to all other widgets created (use "*" instead of "." in the options file if you want a setting to apply to a widget's descendants), but the main window itself just does not seem to "pick up" the settings from the options database. Lines 9 through 11 in the example is the workaround that I have been using. Maybe this is an interaction between Tk and POE? You may also find the Name and -class options to be useful here; they are analogous to the id and class attributes in HTML if you consider the options database analogous to a stylesheet. Lastly, setting the iconname on the main window is important — some window managers can crash while manipulating windows that do not set an icon name. In reply to Re: Verbose Tk Code
by jcb
|
|