当前位置: 首页>>代码示例>>Python>>正文


Python Quartz.kCGNullWindowID方法代码示例

本文整理汇总了Python中Quartz.kCGNullWindowID方法的典型用法代码示例。如果您正苦于以下问题:Python Quartz.kCGNullWindowID方法的具体用法?Python Quartz.kCGNullWindowID怎么用?Python Quartz.kCGNullWindowID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Quartz的用法示例。


在下文中一共展示了Quartz.kCGNullWindowID方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_window_list

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGNullWindowID [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 kCGNullWindowID [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 kCGNullWindowID [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 kCGNullWindowID [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 kCGNullWindowID [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 kCGNullWindowID [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 kCGNullWindowID [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_screen_pixel

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGNullWindowID [as 别名]
def get_screen_pixel(x, y):
    image = CG.CGWindowListCreateImage(
        CoreGraphics.CGRectMake(x, y, 2, 2),
        CG.kCGWindowListOptionOnScreenOnly,
        CG.kCGNullWindowID,
        CG.kCGWindowImageDefault)
    bytes = CG.CGDataProviderCopyData(CG.CGImageGetDataProvider(image))
    b, g, r, a = struct.unpack_from("BBBB", bytes, offset=0)
    return (r, g, b, a) 
开发者ID:laffra,项目名称:happymac,代码行数:11,代码来源:utils.py

示例9: get_all_windows

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGNullWindowID [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

示例10: get_pixels

# 需要导入模块: import Quartz [as 别名]
# 或者: from Quartz import kCGNullWindowID [as 别名]
def get_pixels(self, monitor):
        width, height = monitor[b'width'], monitor[b'height']
        left, top = monitor[b'left'], monitor[b'top']
        rect = Quartz.CGRect((left, top), (width, height))
        options = Quartz.kCGWindowListOptionOnScreenOnly
        winid = Quartz.kCGNullWindowID
        default = Quartz.kCGWindowImageDefault
        self.image = Quartz.CGWindowListCreateImage(rect, options, winid, default)
        if not self.image:
            raise ScreenshotError('MSS: CGWindowListCreateImage() failed.')
        return self.image 
开发者ID:KarlGong,项目名称:ptest,代码行数:13,代码来源:screen_capturer.py


注:本文中的Quartz.kCGNullWindowID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。