winfo_height returns the actual, absolute height of the window. It's not relative to anything.
The reason the value is 1 is because the frame has yet to be displayed on the screen. It is the actual updating of the screen that gives a widget its dimensions, since that depends on the size of the containing window, how it is packed or gridded, what is inside of the frame, etc. None of that can be determined until the window is actually mapped to the display. Simply calling update will cause it to be displayed and thus give you a reasonable number, though calling update is a relatively risky thing to do. On Wed, Apr 10, 2013 at 9:42 AM, GKalman <kalma...@verizon.net> wrote: > Please look at the following Tkinter code fragment: > > #*** > frm=Frame(root,bg="cyan") > frm.pack(side=TOP, fill=BOTH, expand=YES) > h= frm.winfo_height() > print h, type(h) > #*** > > It returns a value of h=1 and type= int > > I remember seeing somewhere that the returned a value of h=1 means that it > is RELATIVE wrt something. > Question: how can I get the ABSOLUTE value for height. > > BTW: > h= frm.cget("height") > print h > > results in a value of h=0 !!! why? > > > > > -- > View this message in context: > http://python.6.x6.nabble.com/question-on-winfo-height-tp5013753.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