473,511 Members | 16,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tk: filling a frame with a widget

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
Oct 4 '06 #1
1 1266

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

Oct 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1820
by: Shankar Iyer (siyer | last post by:
Hi, I am still new to Python and Tkinter, so I apologize in advance if I do not word my question optimally. I am trying to use a frame widget as the parent for other widgets. There is a class...
2
2234
by: Colin McKinnon | last post by:
Hi all, I've got two frames, one with a form ('main') and one with some clickable images ('tp'). The clickable images call a function in 'main' (code below) which in turn calls the .submit() or...
2
1725
by: William Gill | last post by:
I need to display a couple of labels and a checkbox from each entry in my database. Simple enough, but there are several hundred records, and I only want to display 5 or 10 at a time. Can this be...
2
3522
by: Matt | last post by:
all, trying to load an application (notepad for instance) and have it sit inside a Python application window. When the main window maximises or minimises, the (notepad) app follows. I am...
1
2531
by: Gigs_ | last post by:
what is the best way to write tkinter menus? As toplevels or as frame with Menubutton? im doing like this class MyWidget(Frame): def __init__(self, master=None): """ should this master be...
4
1858
by: Marcpp | last post by:
Hi I need to call a widget from a button in WXPYTHON. I've tried to this from a function like this, but when push the button, the program opens a window and do error. Any idea? ...... def...
4
2452
Elias Alhanatis
by: Elias Alhanatis | last post by:
Hello everybody!! I would like some help with the following problem: I have the following piece of code: from Tkinter import * root = Tk()
2
2733
by: devnew | last post by:
i am trying out tkinter to make a gui..i want to have a frame with an embedded file explorer next to a 'open directory' label..i tried out FileDialog and tkFileDialog methods but they open as pop...
0
1248
by: noobuser | last post by:
Not sure if this question belongs here, so sorry if it doesn't. amature programmer here, trying making a media scale widget (like the one in windows media player) for a media player type program...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7423
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.