Python and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Lua, etc
Tk - laying out your GUI with frames, pack and grid
Using Tk (in Tcl or in Perl), you create a number of components that you want to display as part of your GUI (Graphic User Interface) using commands such as button
. These components are known as widgets.
Once you've created your widgets, you need to use a geometry manager to tell the program how to display them in relation to each other - and there are three such geometry managers.
allows you to place your widgets in a row or column
allows you to place your widgets in a matrix
is rarely used, and gives you the ability to place widgets by pixel or by the proportion of the way across the window that you want them to appear.
Pack, grid and place don't on their own provide you with the full flexibility to lay out more complex windows. For a complex layout, you'll split the parent window into a series of frame
s which you will pack or grid, and then you'll pack or grid the individual widgets into the frames. If necessary, you can nest frames several layers deep.
If you're a designer laying out your GUI
, where should you start? With a sketch on a sheet of paper (or a whiteboard). Look to see if the WHOLE layout can be achieved by using a single pack or grid ... if not, look for places where you can draw a line between widgets RIGHT ACROSS the window. These lines are the first level of splitting you GUI down into frames.
If you can draw lines RIGHT ACROSS, both horizontally and vertically, then you'll use the grid
geometry manager for your root window. If you can draw ONLY horizontal or vertical lines, then you'll use pack
Repeat the design process, frames within frames, until each of your remaining subframes is a simple grid or pack in its own right, or is a single widget. (written 2006-06-30)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesT218 - Tcl/Tk - Geometry Managers 
fill and expand on Tcl/Tk pack command - (2007-12-13) 
Tk locks up - 100% c.p.u. on a simple program (Tcl, Perl, Python) - (2007-09-09) 
Expanding a grid - Tcl/Tk - (2007-09-07) 
Sticky news - (2005-09-15) 
Tcl/Tk (wish) Grid layout example - (2005-02-12)T220 - Tcl/Tk - Frames and Other Topics 
Managing the window size (and layout) in Tcl/Tk - (2015-03-12) 
Cliff Lift simulator- Lynton to Lynmouth - in Tcl/Tk - (2007-12-14)
Some other Articles
Strange housewarmingShadow Transport Minister to visit MelkshamHot answers in PHPNew - Conditional expressions in Python 2.5Tk - laying out your GUI with frames, pack and gridFirst Light, Bootle Docks, LiverpoolRunning external processes in Tcl and Tcl/TkWhich way to turn?Good follow up ... my thanksConverting between Hex and Decimal in Tcl
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page
This is a page archived from The Horse's Mouth at
the diary and writings of Graham Ellis.
Every attempt was made to provide current information at the time the
page was written, but things do move forward in our business - new software
releases, price changes, new techniques. Please check back via
our main site for current courses,
prices, versions, etc - any mention of a price in "The Horse's Mouth"
cannot be taken as an offer to supply at that price.
Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).