Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Tk: pack, grid or place?

by rinceWind (Monsignor)
on May 13, 2005 at 15:29 UTC ( #456776=note: print w/ replies, xml ) Need Help??


in reply to Tk: pack, grid or place?

Are there strong reasons for using certain geometry managers?

Yes there are, as far as I am concerned. Here are my guidelines.

  1. pack
  2. This is the simplest of the geomentry managers to use. I think of it as a concertina cardboard box with books stacked against each of the sides. Imagine the concertina contracts to minimise the space in the middle.

    Most of the time, you just stack against one side. However, the other options are useful if you want to add widgets in a different order.

  3. grid
  4. Pack is all very well for simple apps. And you can nest frames with widgets packing in different directions.

    But, the rows and columns will not line up. If the model of what you want to do fits better a matrix of cells, the grid geometry manager gives you this. Think Excel spreadsheet, or better, HTML table.

  5. place
  6. With the other two, positioning of widgets is automatic, and the size of the tol level window fits the size of what it contains.

    The place geometry manager, on the other hand, works like more traditional GUI programming languages, e.g. Visual Basic. Each widget is placed with coordinates of its origin and an exact size.

    place is used when the user has the ability to drag and move widgets around. However, in Tk, this type of activity tends to be done with a canvas.

There are other geometry managers, but these tend to be more specialised and less widely used.

--
I'm Not Just Another Perl Hacker


Comment on Re: Tk: pack, grid or place?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://456776]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (18)
As of 2014-07-31 14:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls