By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

Tkinter Frame Size

P: n/a
I'm tyring to set the size of the window that is opened when you open a
Tkinter window, without much sucess. I have tried changing the heigth
and width atributes, but it doesn't do anything. I tried using the
grid_propagate command that I saw to use, but made the window even
smaller... What can I do? Thanks!

Oct 28 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


On Friday 28 October 2005 10:38, Tuvas wrote:
I'm tyring to set the size of the window that is opened when you open a
Tkinter window, without much sucess. I have tried changing the heigth
and width atributes, but it doesn't do anything. I tried using the
grid_propagate command that I saw to use, but made the window even
smaller... What can I do? Thanks!


Here is a very simple way:

from Tkinter import *
app = Tk()
app.geometry("%dx%d%+d%+d" % (600, 400, 0, 0))
f = Frame(app)
f.pack()
app.mainloop()
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Oct 28 '05 #2

P: n/a
Okay. I have alot of items that are put on the basic frame already,
using a grid method. Will this change anything?

Oct 28 '05 #3

P: n/a
On Friday 28 October 2005 11:00, Tuvas wrote:
Okay. I have alot of items that are put on the basic frame already,
using a grid method. Will this change anything?


It shouldn't. For example

from Tkinter import *
app = Tk()
app.geometry("%dx%d%+d%+d" % (600, 400, 0, 0))
f = Frame(app)
f.pack()
L1 = Label(f, text="Bob & Carol & Ted & Alice")
L1.grid(row=0, column=0, columnspan=2)
L2 = Label(f, text="Barney")
L2.grid(row=1, column=0)
L3 = Label(f, text="Betty")
L3.grid(row=1, column=1)
app.mainloop()

Just grid everything in the frame then pack the frame in the Tk(). However do
not mix grid and pack in the same frame or it will lock up your app. E.g.
*dont* do this:

L1 = Label(f, text="Bob & Carol & Ted & Alice")
L1.grid(row=0, column=0, columnspan=2)
L2 = Label(f, text="Barney")
L2.pack()

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Oct 28 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.