Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hey davies,

Here's my take on Tk geometry:
pack is the most popular because its the easiest to use. This ease of use is ideal for applications that require simple layouts. Consequently, tweaking widget layout can be quite burdensome using pack. If what you are developing has a simple layout, by all means, go with pack.

place uses the cartesian coordinate system for locating widgets. This makes coding widget layout more burdensome because you have to code the coordinates. If you have a lot of widgets, this can become quite tedious. However, it gives you much better layout control. You can tweak to your hearts delight and you can do things with place that are extremely difficult to do with pack. Also, with pack, the final layout depends upon the order in which the widgets are packed. This is not true with place. While not generally a problem, I have run into it sometimes.

my personal favorite is the form geometry manager. Instead of using cartesian coordinates, widget placement is indicated by percentages. This is easier for some people to conceptualize. Also, a great advantage of form is that placing widgets relative to other widgets is extremely easy. When I code gui apps, I am a freak for widget placement control and form is much better than pack or place in this regard. Give it a try sometime.

Also, don't really worry about getting caught in any traps by using a particular layout manager. pack, place, grid, and form are all supported, so its not like someone will run your app and have it fail because of the manager you decide to use. The only things you really need to consider are 1) how much control do you want over layout and 2) how is the code going to be maintained. Then, choose your layout manager accordingly.


In reply to Re: Tk: pack, grid or place? by davidj
in thread Tk: pack, grid or place? by davies

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

  • 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, 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, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (3)
    As of 2018-05-24 22:43 GMT
    Find Nodes?
      Voting Booth?