Tk: filling a frame with a widget

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paolo Pantaleo

    #1

    Tk: filling a frame with a widget

    I have this code

    from Tkinter import *

    root=Tk()
    Button(root).pa ck(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:

  • jmdeschamps@gmail.com

    #2
    Re: Tk: filling a frame with a widget


    Paolo Pantaleo wrote:
    I have this code
    >
    from Tkinter import *
    >
    root=Tk()
    Button(root).pa ck(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).pa ck(expand=1,fil l=BOTH) #HERE use expand=1 as extra
    option
    root.mainloop()

    jean-marc

    Comment

    Working...