Hi Mark,

Thus spoketh Mark Summerfield <l...@qtrac.plus.com> 
unto us on Thu, 28 Jun 2012 14:41:12 +0100:

> Hi,
> 
> I want to set a minsize for a window. Sometimes the window is gridded
> and sometimes not. When it is gridded its winfo_reqwidth() is in
> characters not pixels and vice versa.
> 
> Is there any way to tell whether it is using characters or pixels so
> that I can call minsize() with sensible values (e.g., minsize(100, 100)
> if pixels but minsize(10, 10) if characters).

According to man wm:

(...) the return value is a Tcl list containing four elements
corresponding to the current baseWidth, baseHeight, widthInc, and
heightInc; if window is not currently gridded, then an empty string is
returned.

So you should be able to check the window's "grid state" easily with
wm_grid(), if it's None, the window is not gridded:

>>> root = Tk()
>>> print root.wm_grid()
None
>>> print root.wm_grid(100, 100, 10, 10)
None
>>> print root.wm_grid()
(100, 100, 10, 10)
>>> 

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

        "What terrible way to die."
        "There are no good ways."
                -- Sulu and Kirk, "That Which Survives", stardate unknown
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to