473,609 Members | 2,187 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).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
Oct 4 '06 #1
1 1274

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

Oct 4 '06 #2

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

Similar topics

1
1836
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 with the header "class classtitle(Frame):" in a script called classtitle.py. Having imported classtitle, I create a Frame widget within my gui using the command "w = Frame(self)." Then, I grid this widget and issue the command "classinstance =...
2
2243
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 .reset() methods of the form. The submit call does what is expected. But the reset call throws an error in Mozilla (1.2.1) 'widget.reset is not a function'. It doesn't work in Konqueror (3.1.1) either (don't have an error message - it just don't...
2
1729
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 accomplished by putting everything in a Frame(), using width, height, grid_propagate(0) , and a scrollbar? or do I have to grid 5 rows at a time? If the latter, can I just grid over the previous 5 or do they have to be explicitly removed...
2
3527
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 pretty sure I need to use a frame widget under tkinter (win32) but not exactly sure how to do it. I can make the frame but not embed notepad.
1
2561
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 parent? Because my first tought was that this is toplevel master than i found that its not""" Frame.__init__(self, master) # and this too than self.config(width=200, height=200)
4
1866
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 DialogRRHH(self,event): prog = wx.PySimpleApp(0) wx.InitAllImageHandlers() DialogRRHH = MTRRHH(None, -1, "")
4
2461
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
2741
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 up dialogs.. how do i make this packed into the frame the way button and other widgets can be packed? i am a newbie to tkinter.. any help greatly appreciated TIA dn
0
1252
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 (like windows media player). The problem is that i use a dictionary like this to let the scale know where it needs to be at any point in the song: def create_mapdic(): mapdic={} for i in range(0, length_of_song): ...
0
8109
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8035
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8534
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8509
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8374
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4002
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1630
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1366
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.