當前位置: 首頁>>代碼示例>>Python>>正文


Python Quartz.CGWindowListCopyWindowInfo方法代碼示例

本文整理匯總了Python中Quartz.CGWindowListCopyWindowInfo方法的典型用法代碼示例。如果您正苦於以下問題:Python Quartz.CGWindowListCopyWindowInfo方法的具體用法?Python Quartz.CGWindowListCopyWindowInfo怎麽用?Python Quartz.CGWindowListCopyWindowInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Quartz的用法示例。


在下文中一共展示了Quartz.CGWindowListCopyWindowInfo方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _get_window_list

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def _get_window_list(self):
        """ Returns a dictionary of details about open windows """
        window_list = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID)
        return window_list

    ## Highlighting functions 
開發者ID:glitchassassin,項目名稱:lackey,代碼行數:8,代碼來源:PlatformManagerDarwin.py

示例2: getAllTitles

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def getAllTitles():
    """Returns a list of strings of window titles for all visible windows.
    """

    # Source: https://stackoverflow.com/questions/53237278/obtain-list-of-all-window-titles-on-macos-from-a-python-script/53985082#53985082
    windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID)
    return ['%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')) for win in windows] 
開發者ID:asweigart,項目名稱:PyGetWindow,代碼行數:9,代碼來源:_pygetwindow_macos.py

示例3: getActiveWindow

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def getActiveWindow():
    """Returns a Window object of the currently active Window."""

    # Source: https://stackoverflow.com/questions/5286274/front-most-window-using-cgwindowlistcopywindowinfo
    windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID)
    for win in windows:
        if win['kCGWindowLayer'] == 0:
            return '%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')) # Temporary. For now, we'll just return the title of the active window.
    raise Exception('Could not find an active window.') # Temporary hack. 
開發者ID:asweigart,項目名稱:PyGetWindow,代碼行數:11,代碼來源:_pygetwindow_macos.py

示例4: getWindowsAt

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def getWindowsAt(x, y):
    windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID)
    matches = []
    for win in windows:
        w = win['kCGWindowBounds']
        if pygetwindow.pointInRect(x, y, w['X'], w['Y'], w['Width'], w['Height']):
            matches.append('%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')))
    return matches 
開發者ID:asweigart,項目名稱:PyGetWindow,代碼行數:10,代碼來源:_pygetwindow_macos.py

示例5: getWindowGeometry

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def getWindowGeometry(title):
    # TEMP - this is not a real api, I'm just using this name to stoe these notes for now.
    windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID)
    for win in windows:
        if title in '%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')):
            w = win['kCGWindowBounds']
            return (w['X'], w['Y'], w['Width'], w['Height']) 
開發者ID:asweigart,項目名稱:PyGetWindow,代碼行數:9,代碼來源:_pygetwindow_macos.py

示例6: isVisible

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def isVisible(title):
    # TEMP - this is not a real api, I'm just using this name to stoe these notes for now.
    windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID)
    for win in windows:
        if title in '%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')):
            return win['kCGWindowAlpha'] != 0.0 
開發者ID:asweigart,項目名稱:PyGetWindow,代碼行數:8,代碼來源:_pygetwindow_macos.py

示例7: _is_main_window_open

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def _is_main_window_open(self):
        """Main window, not login one"""
        windows = CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements, kCGNullWindowID)
        for window in windows:
            try:
                if 'Blizzard Battle.net' == window['kCGWindowName']:
                    log.debug('Main Battle.net window was found')
                    return True
            except KeyError:
                continue
        return False 
開發者ID:bartok765,項目名稱:galaxy_blizzard_plugin,代碼行數:13,代碼來源:local_client.py

示例8: get_all_windows

# 需要導入模塊: import Quartz [as 別名]
# 或者: from Quartz import CGWindowListCopyWindowInfo [as 別名]
def get_all_windows():
    global all_windows
    if not all_windows:
        all_windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID)
    for window in all_windows:
        if False and window.valueForKey_('kCGWindowIsOnscreen') :
            print(window)
    return all_windows 
開發者ID:laffra,項目名稱:happymac,代碼行數:10,代碼來源:utils.py


注:本文中的Quartz.CGWindowListCopyWindowInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。