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


Python display.Display方法代码示例

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


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

示例1: snapshot

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def snapshot(self, filename="tmp.png"):
        """
        Take a screenshot and save it to `tmp.png` filename by default

        Args:
            filename: name of file where to store the screenshot

        Returns:
            display the screenshot

        """
        w, h = self.get_current_resolution()
        dsp = display.Display()
        root = dsp.screen().root
        raw = root.get_image(0, 0, w, h, X.ZPixmap, 0xffffffff)
        image = Image.frombytes("RGB", (w, h), raw.data, "raw", "BGRX")
        from airtest.aircv.utils import pil_2_cv2
        image = pil_2_cv2(image)
        return image 
开发者ID:AirtestProject,项目名称:Airtest,代码行数:21,代码来源:linux.py

示例2: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self):
        threading.Thread.__init__(self)
        self.finished = threading.Event()
        
        # Give these some initial values
        self.mouse_position_x = 0
        self.mouse_position_y = 0
        self.ison = {"shift":False, "caps":False}
        
        # Compile our regex statements.
        self.isshift = re.compile('^Shift')
        self.iscaps = re.compile('^Caps_Lock')
        self.shiftablechar = re.compile('^[a-z0-9]$|^minus$|^equal$|^bracketleft$|^bracketright$|^semicolon$|^backslash$|^apostrophe$|^comma$|^period$|^slash$|^grave$')
        self.logrelease = re.compile('.*')
        self.isspace = re.compile('^space$')
        
        # Assign default function actions (do nothing).
        self.KeyDown = lambda x: True
        self.KeyUp = lambda x: True
        self.MouseAllButtonsDown = lambda x: True
        self.MouseAllButtonsUp = lambda x: True
        
        self.contextEventMask = [X.KeyPress,X.MotionNotify]
        
        # Hook to our display.
        self.local_dpy = display.Display()
        self.record_dpy = display.Display() 
开发者ID:OmkarPathak,项目名称:Python-Programs,代码行数:29,代码来源:pyxhook.py

示例3: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self, context, on_skip, on_postpone, style_sheet_path):
        self.context = context
        self.count_labels = []
        self.display = Display()
        self.enable_postpone = False
        self.enable_shortcut = False
        self.is_pretified = False
        self.keycode_shortcut_postpone = 65
        self.keycode_shortcut_skip = 9
        self.on_postpone = on_postpone
        self.on_skip = on_skip
        self.shortcut_disable_time = 2
        self.strict_break = False
        self.windows = []

        # Initialize the theme
        css_provider = Gtk.CssProvider()
        css_provider.load_from_path(style_sheet_path)
        Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) 
开发者ID:slgobinath,项目名称:SafeEyes,代码行数:21,代码来源:break_screen.py

示例4: dostuff

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def dostuff():
    d = display.Display()
    r = d.screen().root
    cm = d.screen().default_colormap

    for i in range(0, 1000):
        if i % 50 == 0:
            print('Iteration', i)

        r.delete_property(Xatom.WM_NORMAL_HINTS)
        r.delete_property(Xatom.WM_NORMAL_HINTS)
        r.get_geometry()
        r.get_geometry()
        r.delete_property(Xatom.WM_NORMAL_HINTS)
        r.delete_property(Xatom.WM_NORMAL_HINTS)
        r.change_property(Xatom.WM_NORMAL_HINTS, Xatom.STRING, 32, [1, 2, 3, 4])
        r.query_tree()
        cm.query_colors([0, 1, 2, 3, 4, 5, 6, 7]) 
开发者ID:python-xlib,项目名称:python-xlib,代码行数:20,代码来源:profilex.py

示例5: main

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def main(argv):
    display = Display()

    thread = EventThread(display)
    thread.start()
    time.sleep(1)

    screen = display.screen()

    # The get_property call should not deadlock, despite the blocking next_event
    # call in the thread.
    atom = display.intern_atom('_XROOTPMAP_ID', True)
    response = screen.root.get_property(atom, Xatom.PIXMAP, 0, 1)
    print('get_property response: %r' % response)

    display.close() 
开发者ID:python-xlib,项目名称:python-xlib,代码行数:18,代码来源:eventthread.py

示例6: main

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def main(argv):
    display = Display()

    if not display.has_extension('XFIXES'):
        if display.query_extension('XFIXES') is None:
            print('XFIXES extension not supported', file=sys.stderr)
            return 1

    xfixes_version = display.xfixes_query_version()
    print('Found XFIXES version %s.%s' % (
      xfixes_version.major_version,
      xfixes_version.minor_version,
    ), file=sys.stderr)

    screen = display.screen()

    print('Hiding cursor ...', file=sys.stderr)
    screen.root.xfixes_hide_cursor()
    display.sync()

    time.sleep(5)

    print('Showing cursor ...', file=sys.stderr)
    screen.root.xfixes_show_cursor()
    display.sync() 
开发者ID:python-xlib,项目名称:python-xlib,代码行数:27,代码来源:xfixes.py

示例7: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self, display: Xdisplay.Display,
                 view, term_info: xutil.TerminalWindowInfo):
        """Changes the foreground color of the gc object.

        Args:
            display (Xlib.display.Display): any created instance
            parent_id (int): the X11 window id of the parent window
        """
        self._display = display
        self._screen = display.screen()
        self._colormap = None
        self.parent_info = term_info
        self.parent_window = None
        self.window = None
        self._view = view
        self._width = 1
        self._height = 1
        self._image = Xshm.Image(
            self._screen.width_in_pixels,
            self._screen.height_in_pixels)
        self.create() 
开发者ID:seebye,项目名称:ueberzug,代码行数:23,代码来源:ui.py

示例8: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self, inkscape_id):
        self.id = inkscape_id
        self.disp = Display()
        self.screen = self.disp.screen()
        self.root = self.screen.root

        self.inkscape = self.disp.create_resource_object('window', inkscape_id)
        self.mode = normal_mode 
开发者ID:gillescastel,项目名称:inkscape-shortcut-manager,代码行数:10,代码来源:main.py

示例9: main

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def main():
    disp = Display()
    screen = disp.screen()
    root = screen.root

    # First listen for existing windows
    for window in root.query_tree().children:
        if is_inkscape(window):
            print('Found existing window')
            listen = threading.Thread(target=create, args=[window.id])
            listen.start()


    # New windows
    root.change_attributes(event_mask=X.SubstructureNotifyMask)
    while True:
        evt = disp.next_event()
        if evt.type == X.CreateNotify:
            window = evt.window
            try:
                if is_inkscape(window):
                    print('New window!')
                    listen = threading.Thread(target=create, args=[window.id])
                    listen.start()

            except Xlib.error.BadWindow:
                pass 
开发者ID:gillescastel,项目名称:inkscape-shortcut-manager,代码行数:29,代码来源:main.py

示例10: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self, _display=None, root=None):
        self.display = _display or display.Display()
        self.root = root or self.display.screen().root
        self.__getAttrs = {
            '_NET_CLIENT_LIST':           self.getClientList,
            '_NET_CLIENT_LIST_STACKING':  self.getClientListStacking,
            '_NET_NUMBER_OF_DESKTOPS':    self.getNumberOfDesktops,
            '_NET_DESKTOP_GEOMETRY':      self.getDesktopGeometry,
            '_NET_DESKTOP_VIEWPORT':      self.getDesktopViewPort,
            '_NET_CURRENT_DESKTOP':       self.getCurrentDesktop,
            '_NET_ACTIVE_WINDOW':         self.getActiveWindow,
            '_NET_WORKAREA':              self.getWorkArea,
            '_NET_SHOWING_DESKTOP':       self.getShowingDesktop,
            '_NET_WM_NAME':               self.getWmName,
            '_NET_WM_VISIBLE_NAME':       self.getWmVisibleName,
            '_NET_WM_DESKTOP':            self.getWmDesktop,
            '_NET_WM_WINDOW_TYPE':        self.getWmWindowType,
            '_NET_WM_STATE':              self.getWmState,
            '_NET_WM_ALLOWED_ACTIONS':    self.getWmAllowedActions,
            '_NET_WM_PID':                self.getWmPid,
        }
        self.__setAttrs = {
            '_NET_NUMBER_OF_DESKTOPS':  self.setNumberOfDesktops,
            '_NET_DESKTOP_GEOMETRY':    self.setDesktopGeometry,
            '_NET_DESKTOP_VIEWPORT':    self.setDesktopViewport,
            '_NET_CURRENT_DESKTOP':     self.setCurrentDesktop,
            '_NET_ACTIVE_WINDOW':       self.setActiveWindow,
            '_NET_SHOWING_DESKTOP':     self.setShowingDesktop,
            '_NET_CLOSE_WINDOW':        self.setCloseWindow,
            '_NET_MOVERESIZE_WINDOW':   self.setMoveResizeWindow,
            '_NET_WM_NAME':             self.setWmName,
            '_NET_WM_VISIBLE_NAME':     self.setWmVisibleName,
            '_NET_WM_DESKTOP':          self.setWmDesktop,
            '_NET_WM_STATE':            self.setWmState,
        }

    # ------------------------ setters properties ------------------------ 
开发者ID:parkouss,项目名称:pyewmh,代码行数:39,代码来源:ewmh.py

示例11: get_current_resolution

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def get_current_resolution(self):
        d = display.Display()
        screen = d.screen()
        w, h = (screen["width_in_pixels"], screen["height_in_pixels"])
        return w, h 
开发者ID:AirtestProject,项目名称:Airtest,代码行数:7,代码来源:linux.py

示例12: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self):
        self.display = display.Display()
        self.root = self.display.screen().root
        self.keys = {} 
开发者ID:pkkid,项目名称:pygrid,代码行数:6,代码来源:pygrid.py

示例13: init_xlib

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def init_xlib(func):
    global xlib_display

    if xlib_display == None:
        xlib_display = display.Display()

    def wrap(*a, **kw):
        ret = func(*a, **kw)
        return ret

    return wrap 
开发者ID:dragondjf,项目名称:QMusic,代码行数:13,代码来源:xutils.py

示例14: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self):
        self.display = Display(os.environ["DISPLAY"])
        self.MOUSE_BUTTONS = {
            "left": 1,
            "middle": 2,
            "right": 3,
            1: 1,
            2: 2,
            3: 3,
            4: 4,
            5: 5,
            6: 6,
            7: 7,
        } 
开发者ID:mozilla,项目名称:iris,代码行数:16,代码来源:xmouse.py

示例15: __init__

# 需要导入模块: from Xlib import display [as 别名]
# 或者: from Xlib.display import Display [as 别名]
def __init__(self):
        self.display = Display(os.environ["DISPLAY"]) 
开发者ID:mozilla,项目名称:iris,代码行数:4,代码来源:keyboard.py


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