def move_window(hwnd, rect, gap=0, border=True):
"""
Moves window.
Args:
hwnd (int): The window handler.
rect: Rect(x, y, w, h) of new location.
Kwargs:
gap (int): Number of pixels between each window.
border (bool): Should invisible border should be accounted for.
"""
BORDER_WIDTH = 7 if border else 0 # Windows 10 has an invisible 8px border
x = int(rect.x) - BORDER_WIDTH + gap // 2
y = int(rect.y) + gap // 2
w = int(rect.w) + 2 * BORDER_WIDTH - gap
h = int(rect.h) + BORDER_WIDTH - gap # No hidden border on top
wg.MoveWindow(hwnd, x, y, w, h, True)
评论列表
文章目录