Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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.

davidj

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

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (5)
    As of 2014-07-13 01:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (244 votes), past polls