What is winfo_id() under Win32
Attila Filetóth
tothfile at freemail.hu
Thu Jan 27 08:09:46 EST 2000
Hi!
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?
So in Windows terminology I have to call a GetParent(hwnd) and for the
hwnd returned call ShowWindow().
The other problem is that I couldn't access to GetParent() by importing
win32ui (where this method should live). Why is it?
To get the above text clearer, here is an example code:
[
from Tkinter import *
from win32con import *
import win32gui
import win32ui
class app(Toplevel):
def __init__(self, master):
self.master = master
Toplevel.__init__(self, master)
self.update_idletasks()
hwnd = self.winfo_id()
# hwnd = win32ui.GetParent(hwnd) # Attribute error: GetParent
win32gui.ShowWindow(hwnd, SW_SHOWMAXIMIZED) # It would only
work after the GetParent() call
root = Tk()
root.withdraw()
app(root)
root.mainloop()
]
(I'm using Python 1.5.2)
Thanks for the help in advance.
Best Regards,
Attila
More information about the Python-list
mailing list