Version 25 of Comparing Geometry Managers

Updated 2003-07-01 15:22:46

kroc 1 July 2003 - The idea is to write a table to explain wich command you can use with grid, pack and place for a wanted result.

Actually, I just try various methods to display correctly a table in the wiki.

First style :

 ------------------------------------------------------------------------------------------------------------------------
 | What do you want to do             | pack command             | grid command             | place command             |
 |------------------------------------|--------------------------|--------------------------|---------------------------|
 | Display 2 widgets side by side     | pack $w1 $w2 -side left  | grid $w1 $w2             | To be done                |
 |------------------------------------|--------------------------|--------------------------|---------------------------|
 | Display 2 widgets on top of        | pack $w1 $w2 -side top   | grid $w1                 | To be done                |
 | each other                         |                          | grid $w2                 |                           |
 ------------------------------------------------------------------------------------------------------------------------

Second style :

 ------------------------------------------------------------------------------------------------------------------------
 | Display 2 widgets side by side:                                                                                      |
 | pack command                          | grid command                         | place command                         |
 |---------------------------------------|--------------------------------------|---------------------------------------|
 | pack $w1 $w2 -side left               | grid $w1 $w2                         | To be done                            |
 |----------------------------------------------------------------------------------------------------------------------|
 | Display 2 widgets on top of each other:                                                                              |
 | pack command                          | grid command                         | place command                         |
 |---------------------------------------|--------------------------------------|---------------------------------------|
 | pack $w1 $w2 -side top                | grid $w1                             | To be done                            |
 |                                       | grid $w2                             |                                       |
 '----------------------------------------------------------------------------------------------------------------------'

Third style :

 |================|=====================================================================================================|
 | You want to    | Display 2 widgets side by side:                                                                     |
 |----------------|-----------------------------------------------------------------------------------------------------|
 | pack command   | pack $w1 $w2 -side left                                                                             |
 |----------------|-----------------------------------------------------------------------------------------------------|
 | grid command   | grid $w1 $w2                                                                                        |
 |----------------|-----------------------------------------------------------------------------------------------------|
 | place command  | To be done.                                                                                         |
 |================|=====================================================================================================|
 | You want to    | Display 2 widgets on top of each other:                                                             |
 |----------------|-----------------------------------------------------------------------------------------------------|
 | pack command   | pack $w1 $w2 -side top                                                                              |
 |----------------|-----------------------------------------------------------------------------------------------------|
 | grid command   | grid $w1                                                                                            |
 |                | grid $w2                                                                                            |
 |----------------|-----------------------------------------------------------------------------------------------------|
 | place command  | To be done.                                                                                         |
 |================|=====================================================================================================|

Fourth style :


You want to: Display 2 widgets side by side

  • pack command : pack $w1 $w2 -side left
  • grid command : grid $w1 $w2
  • place command : To be done.

You want to: Display 2 widgets on top of each other

  • pack command : pack $w1 $w2 -side top
  • grid command : grid $w1 ; grid $w2
  • place command : To be done.

Feel free to add your own style above.