How to get the HWND of a window made with tkinter?
I have already tried this:
print(root.winfo_id())
print(getAllWindows())
However, there is no root.winfo_id()
in the list of getAllWindows()
Why so?
How to get the HWND of a window made with tkinter?
I have already tried this:
print(root.winfo_id())
print(getAllWindows())
However, there is no root.winfo_id()
in the list of getAllWindows()
Why so?
This code:
hwnd = root.winfo_id()
parent_hwnd = win32gui.GetParent(hwnd)
text = win32gui.GetWindowText(parent_hwnd)
print(text)
it will return "System menu", which means it is what you want. Apparently there is a wrapper This simple window coded in PySimpleGUI;
have the following windows (as shown by Spy++) :
The first window in the list is the one we catch (it as 'System menu' as title bar!)