2dfe Tk locks up - 100% c.p.u. on a simple program (Tcl, Perl, Python)
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Tk locks up - 100% c.p.u. on a simple program (Tcl, Perl, Python)

Fighting packs and grids - Tk under Tcl, Perl, Python

You'll use pack OR grid to place components into your frame in a Tcl/Tk application. You may use both pack and grid within the same program, but NOT within the same frame. If you do, not only will you be writing code that has no clear meaning, but you'll also invoke the pack and grid handlers at the same time and may cause them to fight. Have a look at this code:

button .ouch -text "do NOT press this button" -command exit
label .more -text "This is a label"
 
button .wow -text "This is a button you may press" -command exit
label .contd -text "Another BORING! label"
 
grid .more .ouch
pack .ouch .more
pack .contd .wow
grid .wow .contd


When I ran that, my prompt was lost, no wish window appeared, and my c.p.u. utilisation rocketed to 99% ... and stayed there. I guess when you have two individuals fighting, they don't show any regard at all for others around them.

Footnote I've often contended that the way to get a user to select a button is to label it "Do not push this under any circumstances" ... which is what I have put in the example above. Some may say that I have a warped sense of humour, or that I have watched too much "Trigger Happy TV".
(written 2007-09-09, updated 2007-09-11)

 
Associated topics are indexed under
P307 - Perl/Tk
  [3009] Expect in Perl - a short explanation and a practical example - (2010-10-22)
  [1310] Callbacks - a more complex code sandwich - (2007-08-19)
  [738] (Perl) Callbacks - what are they? - (2006-05-30)
  [599] Perl/Tk real time display - (2006-02-10)
  [596] The magic of -textvariable - (2006-02-08)
  [595] Add a friendly front end with Tk - (2006-02-08)

T218 - Tcl/Tk - Geometry Managers
  [1470] fill and expand on Tcl/Tk pack command - (2007-12-13)
  [1335] Expanding a grid - Tcl/Tk - (2007-09-07)
  [787] Tk - laying out your GUI with frames, pack and grid - (2006-06-30)
  [445] Sticky news - (2005-09-15)
  [212] Tcl/Tk (wish) Grid layout example - (2005-02-12)

Y205 - Further uses of Python
  [1663] Python in an afternoon - a lecture for experienced programmers - (2008-06-01)
  [1036] Python Qt, wX, TkInter, and Jython - training?? - (2007-01-16)
  [745] Python modules. The distribution, The Cheese Shop and the Vaults of Parnassus. - (2006-06-05)
  [190] Python engines - (2005-01-26)


5657
Back to
Packages and Namespaces are like Suitcases and Aircraft
Previous and next
or
Horse's mouth home
Forward to
Moving to Melksham? Househunting map.
Some other Articles
Catching up on indexing our resources
Melksham Laundrette
Google, wwmdirectory, Freshwater, ATP - new scam?
Moving to Melksham? Househunting map.
Tk locks up - 100% c.p.u. on a simple program (Tcl, Perl, Python)
Packages and Namespaces are like Suitcases and Aircraft
Handling Binary data in Tcl (with a note on C)
A series of tyre damages
Ignore case in Regular Expression
4086 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 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - 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).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2013: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1340_Tk- ... thon-.html • PAGE BUILT: Sat Feb 23 12:39:13 2013 • BUILD SYSTEM: wizard
0