Fwd: Re: Tkinter : resizing Text widget with main window

johngrayson at home.com johngrayson at home.com
Tue Mar 20 18:58:11 CET 2001


--- In python-list at y..., Erik de Castro Lopo <nospam at m...> wrote:
Rick Pasotto wrote:
>

This does work for grid ().

This DOES work for grid ().

from Tkinter import *

class application:

    def __init__(self, master=None):
        self.master = master

        for r in range(3):
	    master.grid_columnconfigure(r, weight=1)
	    master.grid_rowconfigure(r, weight=1)
            for c in range(3):
                lbl = Text(master, width=30,height=12, bd=3,
                 relief=SUNKEN)
                lbl.grid(row = r, column = c, sticky = NSEW)
                lbl.insert(END, 1000 + r + c)

root = Tk()
root.title('Grid Weight')
g = application(root)
root.mainloop()


The default row and column weight is zero, so the widgets
do not expand to use extra space.

     John Grayson





More information about the Python-list mailing list