Re: A few Tk related queries

From: Bruce Hartweg (bruce-news_at_hartweg.us)
Date: 11/28/03


Date: Fri, 28 Nov 2003 03:02:40 GMT


Arpan Sen wrote:

> Aric Bills wrote:

>
> Hello Aric,
> Thanks a ton for the excellent explanations. But I have a couple of questions
> on what you
> have written. Here they are :
> 1. when i use pack geomtery manager, i have to use -fill x so that things get
> readjusted when
> stretched or shrinked, but my questions is when i pack a menubutton on it
> with side option as
> left what has it got to do with side fill?

because the menubutton *is* on the left, the left of the frame. but the
frame is in the center of the window. so either make the frame fill the
window horizontally (-fill x) or also anchor it to the left side.

one way to help understand geometry stuff is to just play around with
the various options & make each of your windows, frames & other widgets
all have different background colors so you can see how they are working
together

> 2. if i use .top.file.menu add <...> things do not work for me though they
> should and i don't know
> why. i just mentioned the hack i used to bypass it.

please copy/paste the chunk of code you have exactly, as well as the
actual error message (if there is one) or describe the behavior that
occurs.

> I would like to know more about the grid geomtery manager. How does it overcome
> such cases?

it can simplify a great many things for layouts, when using pack to layout
a medium complex gui you can end up with a lot of intervening frames just
to make the layout right. you end up with a .top, .middle ..bottom and
then .top.left .top.right, .top.left.w1 ... etc.

with grid you can just create all of the individual widgets actually needed
and hen lay them out on a virtual grid - each widget can span multiple
"cells" in either direction, they can float within the boundaries of the
occupied cells (or stick to any/all the edges, you can assign weights
for each column and row to allocate extra space during resize. and the
shortcut notation for gridding can be an ascii picture of your gui right
in your code.

Hope this helps,
  bruce



Relevant Pages

  • Re: Is there a graphical GUI builder?
    ... which easily run on Linux and Windows without any GUI ... textual or laid out with pixel-based positioning in a WYSIWYG layout ... window- or font-sizes, like widgets outside of the visible window, text ...
    (comp.lang.python)
  • Re: Is there a graphical GUI builder?
    ... which easily run on Linux and Windows without any GUI ... you set your widgets to fixed positions (e.g. a text ... window- or font-sizes, like widgets outside of the visible window, text ... layout, so you more or less define the layout logically. ...
    (comp.lang.python)
  • geometry propagation
    ... window is manipulated. ... then the grid is centered inside the ... "create_mockframe" sticks widgets into a frame ...
    (comp.lang.tcl)
  • Tkinter pack difficulty
    ... I have three frames stacked top to bottom and stretching across the ... master window from edge to edge. ... the top and bottom, respectively, of the master frame) and the body ... "shrinkwrap" to the size of the actual Frame widgets. ...
    (comp.lang.python)
  • Re: tk widget
    ... But the fields have to be cleared also, meaning they can show in the window but internally they need to be cleared, because when the user types a part no for the first field the rest of the fields are dependent on this part no and the window will adjust based on the number fo fields. ... Your "Clear_ALL" procedure probably needs to delete the widgets. ... You can create an empty frame that serves as a placeholder. ... It's as if each form is a piece of paper in a stack, and you take out the appropriate page and place it on the top of the stack. ...
    (comp.lang.tcl)