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


Python X.MotionNotify方法代码示例

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


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

示例1: __init__

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

示例2: handle_event

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def handle_event(self, event):

        # KeyPress event
        if event.type == X.KeyPress:
            keyname = xrobot.get_keyname(event)
            self.keyPressed.emit(keyname)

        # KeyRelease event
        elif event.type == X.KeyRelease:
            keyname = xrobot.get_keyname(event)
            self.keyReleased.emit(keyname)

        # ButtonPress event
        elif event.type == X.ButtonPress:
            self.buttonPressed.emit(event.root_x, event.root_y, event.time)

        # ButtonRelease event
        elif event.type == X.ButtonRelease:
            self.buttonReleased.emit(event.root_x, event.root_y, event.time)

        # MotionNotify event
        elif event.type == X.MotionNotify:
            self.cursorPositionChanged.emit(event.root_x, event.root_y) 
开发者ID:linuxdeepin,项目名称:deepin-remote-assistance,代码行数:25,代码来源:event.py

示例3: moveTo

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def moveTo(self, location: Location):

        """
        Mouse move to specific Location

        :param location :x,y coordinates where to click

        """
        fake_input(self.display, X.MotionNotify, x=location.x, y=location.y)
        self.display.sync() 
开发者ID:mozilla,项目名称:iris,代码行数:12,代码来源:xmouse.py

示例4: HookMouse

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def HookMouse(self):
        pass
        # We don't need to do anything here anymore, since the default mask 
        # is now set to contain X.MotionNotify
        
        # need mouse motion to track pointer position, since ButtonPress events
        # don't carry that info.
        #self.contextEventMask[1] = X.MotionNotify 
开发者ID:OmkarPathak,项目名称:Python-Programs,代码行数:10,代码来源:pyxhook.py

示例5: processevents

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def processevents(self, reply):
        if reply.category != record.FromServer:
            return
        if reply.client_swapped:
            print ("* received swapped protocol data, cowardly ignored")
            return
        if not len(reply.data) or reply.data[0] < 2:
            # not an event
            return
        data = reply.data
        while len(data):
            event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
            if event.type == X.KeyPress:
                hookevent = self.keypressevent(event)
                self.KeyDown(hookevent)
            elif event.type == X.KeyRelease:
                hookevent = self.keyreleaseevent(event)
                self.KeyUp(hookevent)
            elif event.type == X.ButtonPress:
                hookevent = self.buttonpressevent(event)
                self.MouseAllButtonsDown(hookevent)
            elif event.type == X.ButtonRelease:
                hookevent = self.buttonreleaseevent(event)
                self.MouseAllButtonsUp(hookevent)
            elif event.type == X.MotionNotify:
                # use mouse moves to record mouse position, since press and release events
                # do not give mouse position info (event.root_x and event.root_y have 
                # bogus info).
                self.mousemoveevent(event)
        
        #print "processing events...", event.type 
开发者ID:OmkarPathak,项目名称:Python-Programs,代码行数:33,代码来源:pyxhook.py

示例6: _moveTo

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def _moveTo(x, y):
    fake_input(_display, X.MotionNotify, x=x, y=y)
    _display.sync() 
开发者ID:asweigart,项目名称:pyautogui,代码行数:5,代码来源:_pyautogui_x11.py

示例7: __init__

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [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('|'.join((
            '^[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.MouseMovement = lambda x: True

        self.contextEventMask = [X.KeyPress, X.MotionNotify]

        # Hook to our display.
        self.local_dpy = display.Display()
        self.record_dpy = display.Display() 
开发者ID:nikhilkumarsingh,项目名称:clix,代码行数:43,代码来源:pyxhook.py

示例8: HookMouse

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def HookMouse(self):
        # We don't need to do anything here anymore, since the default mask
        # is now set to contain X.MotionNotify

        # need mouse motion to track pointer position, since ButtonPress
        # events don't carry that info.
        # self.contextEventMask[1] = X.MotionNotify
        pass 
开发者ID:nikhilkumarsingh,项目名称:clix,代码行数:10,代码来源:pyxhook.py

示例9: __init__

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [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:jpdias,项目名称:botnet-lab,代码行数:30,代码来源:pyxhook.py

示例10: HookMouse

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def HookMouse(self):
        pass
        # We don't need to do anything here anymore, since the default mask 
        # is now set to contain X.MotionNotify

        # need mouse motion to track pointer position, since ButtonPress events
        # don't carry that info.
        # self.contextEventMask[1] = X.MotionNotify 
开发者ID:jpdias,项目名称:botnet-lab,代码行数:10,代码来源:pyxhook.py

示例11: processevents

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def processevents(self, reply):
        if reply.category != record.FromServer:
            return
        if reply.client_swapped:
            print "* received swapped protocol data, cowardly ignored"
            return
        if not len(reply.data) or ord(reply.data[0]) < 2:
            # not an event
            return
        data = reply.data
        while len(data):
            event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
            if event.type == X.KeyPress:
                hookevent = self.keypressevent(event)
                self.KeyDown(hookevent)
            elif event.type == X.KeyRelease:
                hookevent = self.keyreleaseevent(event)
                self.KeyUp(hookevent)
            elif event.type == X.ButtonPress:
                hookevent = self.buttonpressevent(event)
                self.MouseAllButtonsDown(hookevent)
            elif event.type == X.ButtonRelease:
                hookevent = self.buttonreleaseevent(event)
                self.MouseAllButtonsUp(hookevent)
            elif event.type == X.MotionNotify:
                # use mouse moves to record mouse position, since press and release events
                # do not give mouse position info (event.root_x and event.root_y have 
                # bogus info).
                self.mousemoveevent(event)

                # print "processing events...", event.type 
开发者ID:jpdias,项目名称:botnet-lab,代码行数:33,代码来源:pyxhook.py

示例12: processevents

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def processevents(self, reply):
        if reply.category != record.FromServer:
            return
        if reply.client_swapped:
            print "* received swapped protocol data, cowardly ignored"
            return
        if not len(reply.data) or ord(reply.data[0]) < 2:
            # not an event
            return
        data = reply.data
        while len(data):
            event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
            if event.type == X.KeyPress:
                hookevent = self.keypressevent(event)
                self.KeyDown(hookevent)
            elif event.type == X.KeyRelease:
                hookevent = self.keyreleaseevent(event)
                self.KeyUp(hookevent)
            elif event.type == X.ButtonPress:
                hookevent = self.buttonpressevent(event)
                self.MouseAllButtonsDown(hookevent)
            elif event.type == X.ButtonRelease:
                hookevent = self.buttonreleaseevent(event)
                self.MouseAllButtonsUp(hookevent)
            elif event.type == X.MotionNotify:
                # use mouse moves to record mouse position, since press and release events
                # do not give mouse position info (event.root_x and event.root_y have 
                # bogus info).
                self.mousemoveevent(event)
        
        #print "processing events...", event.type 
开发者ID:hiamandeep,项目名称:py-keylogger,代码行数:33,代码来源:pyxhook.py

示例13: __init__

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [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.MouseMovement = lambda x: True

        self.contextEventMask = [X.KeyPress,X.MotionNotify]

        # Hook to our display.
        self.local_dpy = display.Display()
        self.record_dpy = display.Display() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:30,代码来源:pyxhook.py

示例14: HookMouse

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def HookMouse(self):
        pass
        # We don't need to do anything here anymore, since the default mask
        # is now set to contain X.MotionNotify

        # need mouse motion to track pointer position, since ButtonPress events
        # don't carry that info.
        #self.contextEventMask[1] = X.MotionNotify 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:10,代码来源:pyxhook.py

示例15: processevents

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import MotionNotify [as 别名]
def processevents(self, reply):
        if reply.category != record.FromServer:
            return
        if reply.client_swapped:
            print("* received swapped protocol data, cowardly ignored")
            return
        if not len(reply.data) or ord(reply.data[0]) < 2:
            # not an event
            return
        data = reply.data
        while len(data):
            event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
            if event.type == X.KeyPress:
                hookevent = self.keypressevent(event)
                self.KeyDown(hookevent)
            elif event.type == X.KeyRelease:
                hookevent = self.keyreleaseevent(event)
                self.KeyUp(hookevent)
            elif event.type == X.ButtonPress:
                hookevent = self.buttonpressevent(event)
                self.MouseAllButtonsDown(hookevent)
            elif event.type == X.ButtonRelease:
                hookevent = self.buttonreleaseevent(event)
                self.MouseAllButtonsUp(hookevent)
            elif event.type == X.MotionNotify:
                # use mouse moves to record mouse position, since press and release events
                # do not give mouse position info (event.root_x and event.root_y have
                # bogus info).
                hookevent = self.mousemoveevent(event)
                self.MouseMovement(hookevent)

        #print "processing events...", event.type 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:34,代码来源:pyxhook.py


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