In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Hi, > > I am looking for example code that consists of just a frame and a >grid(10x2). The grid must fill the its parent even if the frame is >resized.
This simple program makes a two element window, the lower half of which is a gridded set of labels which resize with the window. The important part is the columnconfigure() and rowconfigure() method calls on the container widget for the grid. See <URL:http://infohost.nmt.edu/tcc/help/pubs/tkinter/grid-config.html> http://infohost.nmt.edu/tcc/help/pubs/tkinter/grid-config.html #!/usr/local/bin/python from Tkinter import * root = Tk() # create a frame (unused, but shared with gridded frame) f = Frame(height = 100) f.pack(expand = YES, fill = BOTH) # create a frame for a gridded display gf = Frame() gf.pack(expand = YES, fill = BOTH) # create a 3 x 4 array of labels, each with a different background # Make each row and column have equal weights, so they'll # grow and shrink together for row in range(3): gf.rowconfigure(row, weight = 1) for col in range(4): gf.columnconfigure(col, weight = 1) Label(gf, text = "Row: %d\nCol: %d" % (row, col), bg = "#%02x%02x%02x" % ((row * 4 + col) * 16, (row * 4 + col) * 16, (row * 4 + col) * 16), fg = "#ffffff" ).grid(row = row, column = col, sticky = NSEW) root.mainloop() -- Jim Segrave ([EMAIL PROTECTED]) -- http://mail.python.org/mailman/listinfo/python-list