本文整理汇总了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
示例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]
示例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.
示例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
示例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'])
示例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
示例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
示例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