tkinter: grid: expand and fill

Keith Murphy kpmurphy at my-deja.com
Tue Jul 25 10:19:00 EDT 2000


thanks guys!

-->keith

In article <diaf5.8471$yE4.138541 at news2-win.server.ntlworld.com>,
  "richard_chamberlain" <richard_chamberlain at ntlworld.com> wrote:
> row_configure(0,weight=1)
> column_configure(0,weight=1)
>
> Richard
>
> Dan Kuchler <kuchler at ajubasolutions.com> wrote in message
> news:397CCB2D.DFD84326 at ajubasolutions.com...
> > Keith Murphy wrote:
> > >
> > > here's my example that still doesn't work:
> > >
> > > class scrolledtext:
> > >     def __init__(self, master, scrollflags=(NO,NO)):
> > >         stxt = self.stxt = Frame(master)
> > >         txt = Text(stxt, height=5)
> > >         txt.grid(row=0, column=0, sticky=NSEW)
> > >
> > >         if scrollflags[0]:
> > >             hbar = Scrollbar(stxt, orient=HORIZONTAL,
takefocus=NO,
> > > width=10)
> > >             hbar.grid(row=1, column=0, sticky=W+E, columnspan=2)
> > >             txt.config(xscrollcommand=hbar.set)
> > >
> > >         if scrollflags[1]:
> > >             vbar = Scrollbar(stxt, orient=VERTICAL, takefocus=NO,
> > > width=10)
> > >             vbar.grid(row=0, column=1, sticky=N+S)
> > >             txt.config(yscrollcommand=vbar.set)
> > >
> > > ...called with the following line:
> > > statustxt = scrolledtext(sbar, (YES, YES))
> > > where sbar is a frame.
> > >
> > > i want the text to fill the area except for the spots where the
scroll
> > > bars are.  i also want the window to be able to be resized.  help!
> > >
> > > thanks,
> > > -->keith
> > >
> > > > > is there a way to make a frame, that's been formatted using
grid,
> > > > expand
> > > > > to fill the space it is given?
> >
> > In tcl/tk this would be solved by making column 0 and
> > row 0 have a weight of 1 and by making column 1 and row
> > 1 have a weight of 0.
> >
> > This would be done using 'grid columnconfigure' and 'grid
> > rowconfigure' in combination with the sticky code that you
> > already added.
> >
> > If you can find the python equivalent of setting the weight
> > of the columns and rows, I think your code should work.
> >
> > --Dan
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list