tkinter question

Eric Brunel see.signature at no.spam
Fri Oct 5 04:42:23 EDT 2007


On Fri, 05 Oct 2007 05:16:14 +0200, goldtech <goldtech at worldpost.com>  
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()

=> listbox.pack(fill=BOTH, expand=1)

> i='123456789abcdefghijklmnopqrstuvwxyz'
> for x in range(10):
>     listbox.insert(END, i)
> listbox.config(yscrollcommand=scrollbar.set)
> scrollbar.config(command=listbox.yview)
> mainloop()

BTW, even for something that simple, using the grid geometry manager may  
be easier... It is at least easier to explain: don't ask me what the  
expand=1 option means, I never understood it... I just add or remove it  
when the pack doesn't do what I want. The sticky option with grid is  
easier to handle.

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list