Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

As si_lence noted above, you need to give the -expand option when packing the widget. The difference between -fill and -expand is a little confusing if you don't know exactly how pack operates. You can find a more detailed description in the pack manpage under the section "The Packer Algorithm".

Widgets are packed in the order you specify in your program. The space available to a widget depends on what has already been packed into the same window. The first widget can take all of the space it needs, the second has whatever is left over from the first, and so on. The space that pack gives to a widget is called its parcel, which it determines from the amount of available space and how much space the widget requested (with the -width and -height options).

The -fill option is used when a widget's parcel is bigger than the size it requested. If the parcel is bigger, the widget will be resized to "fill" the space if the -fill option was given.

The -expand option is used at the very end, once all widgets have been packed for a given window. At that point, if there is still extra space in the window, the remaining space is divided up among all widgets that were packed with -expand. In other words, those widgets get their parcels "expanded", so that all of the window's space will be used.

In summary, -expand does not directly affect the widget itself, but the widget's parcel. It means, "If the window has extra room, expand this widget's parcel: give it some more space." On the other hand, -fill does directly affect the widget. It means, "If this widget was allocated more space than it needed, resize the widget so that it fills all of the space."


In reply to Re: Expanding a Text Widget by kelan
in thread Expanding a Text Widget by Scarborough

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found