473,467 Members | 1,300 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Tkinter and fixed-size frames

Hello,

A friend is having an issue with Tkinter that I'm not able to help him
with, so I'm posting here.

He'd like to put something inside of a frame without the frame
automagickally resizing.

Example:

from Tkinter import *

root = Tk()

# with these 2 frames by themselves, they are the
# size requested (the second one is "elastic")

f01 = Frame( root, width="40px", height="60px",
background="#FFE0E0",
borderwidth=1,
relief=GROOVE,
)
f01.pack( side=LEFT )

f02 = Frame( root, width="40px", height="60px",
background="#E0FFE0",
borderwidth=1,
relief=GROOVE,
)
f02.pack( side=LEFT, fill=Y )

# uncomment this, and the left frame changes its size to this
#l01 = Label( f01, text="01",
# background="#E0E0FF",
# borderwidth=2,
# relief="ridge",
# )
#l01.pack( side=TOP, expand=Y, fill=BOTH )

# and this doesn't help either
#s01 = Frame( f01 )
#s01.pack( side=TOP, expand=Y, fill=BOTH )

root.mainloop()

Any suggestions on how to maintain the size of the frame when you pack
a label into it like this?

Thanks,
Mike

Mar 29 '06 #1
2 11336
"msoulier" <ms******@gmail.com> wrote:
Any suggestions on how to maintain the size of the frame when you pack
a label into it like this?


calling pack_propagate(0) on the parent widget should work:

http://effbot.org/tkinterbook/pack.h...opagate-method

</F>

Mar 29 '06 #2
> calling pack_propagate(0) on the parent widget should work:

Indeed it does.

Many thanks.

Mike

Mar 29 '06 #3

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

Similar topics

3
by: Ton K. | last post by:
Folks, I get subject when binding <Button-1> to a listbox. The value for h is '??' which triggers the error. I'm running Python 2.2.2 from SuSE. Please help TK
6
by: Richard Lewis | last post by:
Hi there, I've got a tree control in Tkinter (using the ESRF Tree module) but I can't get it to layout how I want it. I'd like to have it so that it streches north/south (anchored to the top...
2
by: Andrew Trevorrow | last post by:
Our app uses embedded Python to allow users to run arbitrary scripts. Scripts that import Tkinter run fine on Windows, but on Mac OS X there is a serious problem. After a script does "root = Tk()"...
3
by: H J van Rooyen | last post by:
Hi, Still struggling with my GUI exercise - I have the following lines of code in a routine that is bound at <Key-Returnto an instance of Entry : self.disp.Amount_des = Label(self.disp,...
3
by: dug | last post by:
Hi, I have a small program that moves some shapes around a tkinter canvas. Is there any way to save the output in a movie file, maybe mpeg? Thank you, Douglas
2
by: Ben Finney | last post by:
Howdy all, Python programmers looking for a built-in GUI toolkit are told two things: one, Python already comes with a GUI toolkit, and two, it looks equally ugly on all platforms. This is...
4
by: beginner | last post by:
Hi All, I am really new to Tk and Tkinter. I googled the web but it was not mentioned how to build a data grid with Tkinter. Basically, I want to show an excel like data grid with fixed column...
5
by: msunderwd | last post by:
Having a problem with "compiling" a Tkinter/python program using py2exe (and pyinstaller, for that matter)... I have several dialogs that are derived from the tkSimpleDialog.Dialog class. These...
0
by: Helmut Jarausch | last post by:
Hi, I'd like to bind the '<Return>' event to a function which does some calculations (like a database lookup) and then invoke tk_focusNext. I get an exception as many others have reported...
3
by: Eric Brunel | last post by:
Hello all, I'm trying out Python 2.6 and I found what might be a bug in the Tkinter module. How can I report it? The possible bug is a traceback when trying to delete a menu item in a menu...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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
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
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.