utils.py 文件源码

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

项目:garden.notification 作者: kivy-garden 项目源码 文件源码
def taskbar():
    if platform == 'win':
        # example:
        # right side  x>0  y=0    (1474,   0, 1536, 864)
        # left side   x=0  y<R/2  (   0,   0,   62, 864)
        # top side    x=0  y=0    (   0,   0, 1536,  27)
        # bot side    x=0  y>R/2  (   0, 837, 1536, 864)

        # get resolution to get taskbar position
        res = sys_resolution()

        # get taskbar rectangle
        handle = win32gui.FindWindow("Shell_traywnd", None)
        left, top, right, bottom = win32gui.GetWindowRect(handle)

        x = y = 0
        width, height = res

        if left:
            pos = 'right'
            x = left
            width = right - left
        elif right < res['y'] / 2.0:
            pos = 'left'
            width = right
        elif right > res['y'] / 2.0 and not top:
            pos = 'top'
            height = bottom
        elif right > res['y'] / 2.0 and top:
            pos = 'bottom'
            y = top
            height = bottom - top
    else:
        x, y, width, height, pos = (0, 0, 0, 0, '')

    return {
        'x': x, 'y': y,
        'width': width, 'height': height,
        'pos': pos
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号