window_api.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pyty 作者: howardjohn 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号