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


Python rq.EventField方法代碼示例

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


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

示例1: __processEvent

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [as 別名]
def __processEvent(self, reply):
        if reply.category != record.FromServer:
            return
        if reply.client_swapped:
            return
        if not len(reply.data) or str_or_bytes_to_bytes(reply.data)[0] < 2:
            # not an event
            return

        data = reply.data
        while len(data):
            event, data = rq.EventField(None).parse_binary_value(data, self.recordDisplay.display, None, None)
            if event.type == X.KeyPress:
                self.handle_keypress(event.detail)
            elif event.type == X.KeyRelease:
                self.handle_keyrelease(event.detail)
            elif event.type == X.ButtonPress:
                self.handle_mouseclick(event.detail, event.root_x, event.root_y) 
開發者ID:autokey,項目名稱:autokey,代碼行數:20,代碼來源:interface.py

示例2: processevents

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [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

示例3: processevents

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [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

示例4: processevents

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [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

示例5: processevents

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [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

示例6: record_callback

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [as 別名]
def record_callback(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, record_dpy.display, None, None)

        if event.type in [X.KeyPress, X.KeyRelease]:
            pr = event.type == X.KeyPress and "Press" or "Release"

            keysym = local_dpy.keycode_to_keysym(event.detail, 0)
            if not keysym:
                print("KeyCode%s" % pr, event.detail)
            else:
                print("KeyStr%s" % pr, lookup_keysym(keysym))

            if event.type == X.KeyPress and keysym == XK.XK_Escape:
                local_dpy.record_disable_context(ctx)
                local_dpy.flush()
                return
        elif event.type == X.ButtonPress:
            print("ButtonPress", event.detail)
        elif event.type == X.ButtonRelease:
            print("ButtonRelease", event.detail)
        elif event.type == X.MotionNotify:
            print("MotionNotify", event.root_x, event.root_y)


# Check if the extension is present 
開發者ID:python-xlib,項目名稱:python-xlib,代碼行數:38,代碼來源:record_demo.py

示例7: processevents

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [as 別名]
def processevents(self, reply):
        if reply.category != record.FromServer:
            return
        if reply.client_swapped:
            print_err('* received swapped protocol data, cowardly ignored')
            return
        try:
            # Python 2
            intval = ord(reply.data[0])
        except TypeError:
            # Python 3.
            intval = reply.data[0]
        if (not reply.data) or (intval < 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:GiacomoLaw,項目名稱:Keylogger,代碼行數:45,代碼來源:pyxhook.py

示例8: processevents

# 需要導入模塊: from Xlib.protocol import rq [as 別名]
# 或者: from Xlib.protocol.rq import EventField [as 別名]
def processevents(self, reply):
        if reply.category != record.FromServer:
            return
        if reply.client_swapped:
            print("* received swapped protocol data, cowardly ignored")
            return
        try:
            # Get int value, python2.
            intval = ord(reply.data[0])
        except TypeError:
            # Already bytes/ints, python3.
            intval = reply.data[0]
        if (not reply.data) or (intval < 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:nikhilkumarsingh,項目名稱:clix,代碼行數:45,代碼來源:pyxhook.py


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