There are various ways to lay out frames in a window. What I tend to do is to use frames to contain sets of widgets, and then simply
pack() the frames onto the mainwindow. This provides the default packing, which is to stack the frames one after the other from the top of the window to the bottom.
If you'd like to do more than this, you can pack frames to one of the sides of the window. This is achieved as follows:
my $mw = new MainWindow;
my $frame = $mw->Frame();
# do something with the frame
$frame->pack(-side => 'left');
Here,
side can take the values top, bottom, left or right, packing the frames to the respective side of the window. The default is 'top'.
Moving up a step, you can change the order that frames are packed in using the $frame->pack(-after => $otherframe); syntax. after may be replaced with before to have the opposite effect.
A multitude of other functionality for pack is available, without even mentioning the other layout managers. If you're likely to be using Tk a lot, I'd advise you get youself a good book on the subject (I'd recommend Learning Perl/Tk from O'Reilly).
Hope that helps a little.
-- Foxcub
#include www.liquidfusion.org.uk
Update: Typo correction (thanks herveus)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.