tkinter question

Michal Bozon bozonm at vscht.cz
Fri Oct 5 06:33:16 EDT 2007


On Thu, 04 Oct 2007 20:16:14 -0700, goldtech wrote:

> This works OK. But I notice that if I enlarge the window after the
> script has run, the white listbox only gets "so" big while the grey
> background enlarges.
> 
> Is there a way to have it all white when I enlarge a window - like
> what normally happens?
> 
> 
> 
> from Tkinter import *
> root = Tk()
> root.title("Dirty Words")
> scrollbar = Scrollbar(root)
> scrollbar.pack(side=RIGHT, fill=Y)
> listbox = Listbox(root, bg='white', font = "Courier 16", width=60)
> listbox.pack()
> i='123456789abcdefghijklmnopqrstuvwxyz'
> for x in range(10):
>     listbox.insert(END, i)
> listbox.config(yscrollcommand=scrollbar.set)
> scrollbar.config(command=listbox.yview)
> mainloop()

try to change listbox.pack() to listbox.pack(expand=True, fill=BOTH)
.. is it that you want ?

 -mykhal



More information about the Python-list mailing list