Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: k-Means Clustering demo program with Tk

by bart (Canon)
on Apr 09, 2006 at 17:55 UTC ( #542158=note: print w/ replies, xml ) Need Help??


in reply to Re: k-Means Clustering demo program with Tk
in thread k-Means Clustering demo program with Tk

The labels? Ah yes, the cause must be the difference in default font size.

But your entry text box, for the number of clusters, now looks very big, doesn't it? And you resorted to use a fixed width for the coordinates, 3 digits per coordinate, or else the widgets would jump to the left and to the right.

I really really dispise layout managers, Java's AWT is another one like that.


Comment on Re^2: k-Means Clustering demo program with Tk
Re^3: k-Means Clustering demo program with Tk
by zentara (Archbishop) on Apr 09, 2006 at 19:04 UTC
    Well I just made the minimal changes to make packing work. The way you would normally do it, is pack sub-frames into frames. So I just packed the widgets to side=>left with some padding. But a better way, would be to make separate little frames, one for each label and entry combo ( or whatever), assign them default widths, and pack the frames into the frames. It's more work than I cared to do on a Sunday morning, :-) but that is how you usually do it. The trick with frame packing is to remember that the frame gets it's size from the widgets it contains, so if you want to maintain a frame's width, you must set a widget in it with a -width=>$somemin.

    The sprintf on the digits was the easiest way out, but you could have set them in there own frame, set an alignment on the label packing, and give a -width to the label, to hold it steady.

    Of course in a GUI app, half your time is spent making it appear and resize correctly, and pack makes that easier in the long run.


    I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-12-26 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls