My problem is that I wish to find out the size of a Frame, that is a
have added x amount of items
to it and now wish to know how high/wide the frame is so that I can
scroll it properly (using a Canvas
wrapper). I'm sure there must be a way of finding out, for example, that
the height is 5 inches or 200 pixels
or something. Howver, I just cannot find that way.
I hope someone out there can help me.
Thanks is advance,
Sacha Groves
> My problem is that I wish to find out the size of a Frame, that is a
> have added x amount of items
> to it and now wish to know how high/wide the frame is so that I can
> scroll it properly (using a Canvas
> wrapper). I'm sure there must be a way of finding out, for example, that
> the height is 5 inches or 200 pixels
> or something. Howver, I just cannot find that way.
Having done
f=Frame(...)
x=Text(f,{Pack:{'side':'top'}})
. . .
you can do
width=f.winfo_reqwidth()
height=f.winfo_reqheight()
before display, or
width=f.winfo_width()
height=f.winfo_height()
afterwards. See the 'winfo' manual page/help entry from Tcl/Tk, and
then check Tkinter.py for calling sequence if you need more help.
Exactly which to use, and whether you need update() or
update_idletasks() before you get a reliable answer, is something
which unfortunately varies from platform to platform (this is a Tk
problem, not a Tkinter one).
YMMV, hope this helps
ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: h...@cogsci.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/