我正在尝试让一些更有趣的 Windows Aero 效果在 Python 中运行。
DwmExtendFrameIntoClientArea 函数可用于将 Aero 玻璃扩展到客户区。它需要一个窗口句柄和一个指向 MARGINS 结构的指针。我已经知道如何在 Python 中获取窗口句柄;但是,我不知道如何制作边距结构。
这是我目前所拥有的:
import Tkinter as tk
import string
import ctypes
root = tk.Tk()
handle = string.atoi(root.wm_frame(), 0)
dwm = ctypes.windll.dwmapi
# needs pointertomarginsstruct
dwm.DwmExtendFrameIntoClientArea(handel, pointertomarginsstruct)
root.mainloop()
最佳答案
我没有运行 Win7 来测试这个,但尝试用 ctypes 定义结构:
class MARGINS(ctypes.Structure):
_fields_ = [("cxLeftWidth", c_int),
("cxRightWidth", c_int),
("cyTopHeight", c_int),
("cyBottomHeight", c_int)
]
margins = MARGINS(1, 2, 1, 1)
dwm.DwmExtendFrameIntoClientArea(handel, ctypes.byref(margins))
关于python - Python 中的 Windows 7 MARGINS 结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7197327/