tkinter: grid: expand and fill

Keith Murphy kpmurphy at my-deja.com
Mon Jul 24 13:36:45 EDT 2000


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


In article <8lhs6l$tpt$1 at nnrp1.deja.com>,
  John Grayson <johngrayson at home.com> wrote:
> In article <8lhrbd$t4v$1 at nnrp1.deja.com>,
>   Keith Murphy <kpmurphy at my-deja.com> wrote:
> > is there a way to make a frame, that's been formatted using grid,
> expand
> > to fill the space it is given?
> >
> > thanks,
> > -->keith
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Try  " sticky=NSWE " in the grid method call for the frame...
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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



More information about the Python-list mailing list