[Tutor] Tkinter Grid, Listbox expand

W W srilyk at gmail.com
Thu Feb 26 20:24:56 CET 2009


I'm writing a Tkinter program and having severe problems with getting
my listbox to expand when I resize the window.

Here's my code so far:

  1 from Tkinter import *
  2 import os, shutil, tkFileDialog, tkMessageBox
  4 class TkSync:
  5     def __init__(self, root):
  6         self.sbox = Listbox(root)
  7         self.sbox.grid(row=0, column=0, sticky=N+S+E+W)
  8         root.grid_rowconfigure(0, minsize=400)
  9         root.grid_columnconfigure(0, minsize=400)
 11 root = Tk()
 12 TkSync(root)
 13 root.mainloop()

When I run that, it sizes right to start out... but then it won't get
any bigger. I've tried various different combinations and nothing has
worked quite right.


To be considered stupid and to be told so is more painful than being
called gluttonous, mendacious, violent, lascivious, lazy, cowardly:
every weakness, every vice, has found its defenders, its rhetoric, its
ennoblement and exaltation, but stupidity hasn’t. - Primo Levi

More information about the Tutor mailing list