tkinter, grid and resize

Bob van der Poel bvdpoel at uniserve.com
Sat Jun 24 14:42:09 EDT 2000


I'm having a problem getting widgets managed by grid to resize
themselves when the screen size changes. This is easy to do using the
pack manager and 'expand', however 'expand' doesn't exist in grid and
the docs seem to indicate that the 'news' sticky option should do the
same. The following snippet creates a text widget with scrollbars. If
you resize the main window, the widgets do not resize....

from Tkinter import *

root=Tk()

ys = Scrollbar(root)
xs = Scrollbar(root)

dsp = Text(root, yscrollcommand=ys.set, xscrollcommand=xs.set)
xs.config(orient='hor', command=dsp.xview)
ys.config(orient='vert', command=dsp.yview)
xs.grid(row=1, column=1, sticky=E+W)
ys.grid(row=0, column=0, sticky=N+S)
dsp.grid(row=0, column=1, sticky=N+S+E+W)

root.mainloop()

What am I don't wrong? I've tried to insert columnspan stuff and played
with the weight options--but I don't seem to be getting it.

Thanks.

-- 
   __
  /  )      /         Bob van der Poel
 /--<  ____/__        bvdpoel at uniserve.com
/___/_(_) /_)         http://users.uniserve.com/~bvdpoel




More information about the Python-list mailing list