What is winfo_id() under Win32

Fredrik Lundh fredrik at pythonware.com
Tue Feb 1 07:50:27 EST 2000

Attila Filetóth <tothfile at freemail.hu> wrote:
> I would like to maximize a Toplevel window created from python in Win32.
> Since I couldn't find any methods (or options) in Tkinter I've tried
> win32xxx imports. I obtained the hwnd from self.winfo_id() and then
> tried a win32gui.ShowWindow(hwnd, SW_SHOWMAXIMIZED): It didn't work.
> I've checked the hwnd with Spy and I realized the window is composed of
> two windows (hwnds): one is for the outer and one for the inner area (as
> the outer's child). And winfo_id() returns  hwnd of the inner area.
> Is it normal?


you should be able to use wm_frame() (aka frame()) to
get hold of the outer window:

    inner = w.winfo_id()
    outer = string.atoi(w.wm_frame(), 0)

(wm_frame() returns the handle as a hex string).

Note that if the window hasn't been reparented by the
"window manager", both methods return the same window


<!-- (the eff-bot guide to) the standard python library:

More information about the Python-list mailing list