Tk: filling a frame with a widget

jmdeschamps at gmail.com jmdeschamps at gmail.com
Wed Oct 4 19:10:42 CEST 2006


Paolo Pantaleo wrote:
> I have this code
>
> from Tkinter import *
>
> root=Tk()
> Button(root).pack(fill=BOTH)
> root.mainloop()
>
> I would expect the button filling all the client draw area of the
> Frame, but when I resize the root window the button becomes wider, but
> not higher ( I get some empty space under the button). How could set
> the button to fill always all the space available?
>
> Well maybe some other solution exists, since my problem is this:
>
> I have a resizable window and i want to keep it filled with a Canvas
> displaying an image (PhotoImage). Can I get the in some way the size
> of the clien draw area of the window containig the canvas?
>
> Thnx
> PAolo
>
> --
> if you have a minute to spend please visit my photogrphy site:
> http://mypic.co.nr

you also need to expand it as in
from Tkinter import *

root=Tk()
Button(root).pack(expand=1,fill=BOTH)  #HERE use expand=1 as extra
option
root.mainloop()  

jean-marc




More information about the Python-list mailing list