tkinter grid() question
Garrett G. Hodgson
garry at research.att.com
Fri Nov 5 10:50:52 EST 1999
Greg Ewing wrote:
>
> "Garrett G. Hodgson" wrote:
> >
> > in the code below, i create a Text entry area with a Scrollbar.
> > i want this pair to always use all of the available space.
> > but when i resize the window, the stay the same size, neither
> > expanding or shrinking.
>
> You have to do two things: make the Text widget sticky on
> all sides, and configure the weight of the row and column
> containing the Text widget so that it sucks up all the
> extra space.
>
> It's simplest if the widgets only take up one cell of
> the grid each, so I'll show you how to do it that way:
>
> self.body.grid(row = 0, column = 0, sticky = N+S+E+W)
> scrollbar.grid(row = 0, column = 1, sticky = N+S)
> self.rowconfigure(0, weight = 1)
> self.columnconfigure(0, weight = 1)
bingo. that did it.
> If you're going to put other widgets in the frame as
> well, you'll have to be careful how you configure the
> grid so that resizing the text widget properly doesn't
> have undesirable side effects on the layout of the other
> widgets.
indeed, my orignal code had more stuff in it. i'd simplified
it for purposes of the question.
thanks very much for your help.
--
Garry Hodgson "Hey, mister, can ya tell me,
garry at sage.att.com where a man might find a bed?"
Software Innovation Services He just grinned and shook my hand,
AT&T Labs "No", was all he said.
More information about the Python-list
mailing list