Hi Alex,

  Several issues here.

1)  In some cases, the size a frame will eventually have
depends on what is packed/gridded inside it. So it m,ay not
be possible to tell the size of the frame before adding the list boxes.

The exception here is if you use tell the frame to take the
maximum space (e.g., for pack: expand=True, fill=BOTH
for grid: sticky=NSEW

You can then pack/grid your Frame, and then ask how big it is
using frm.winfo_geometry() or frm.winfo_height() and frm.winfo_width()

2) You cannot get the frame's size until it is packed and displayed.
So, what you can do is something like the following, using update:

from Tkinter import *
tk = Tk()
Label(tk, text="HELLO").pack(side=TOP)
fr=Frame(tk)
fr.pack(side=TOP, fill=BOTH, expand=True)
print "frame size before update: ", fr.winfo_width(), fr.winfo_height()
fr.update()
print "frame size after update: ", fr.winfo_width(), fr.winfo_height()
tk.mainloop()


Not always possible to do this,

Mick




On Tue, Aug 19, 2008 at 5:38 AM, Alexnb <[EMAIL PROTECTED]> wrote:
>
> I have two listBoxes in one Frame. I want to make them the same size. I want
> to make them half of the width of the Frame they are in. I just can't figure
> out how to get the width of a Frame, just a window. Help?
> --
> View this message in context: 
> http://www.nabble.com/getting-width-of-a-Frame-tp19043845p19043845.html
> Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to