本文整理汇总了Python中Xlib.X.ButtonRelease方法的典型用法代码示例。如果您正苦于以下问题:Python X.ButtonRelease方法的具体用法?Python X.ButtonRelease怎么用?Python X.ButtonRelease使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xlib.X
的用法示例。
在下文中一共展示了X.ButtonRelease方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makemousehookevent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def makemousehookevent(self, event):
storewm = self.xwindowinfo()
if event.detail == 1:
MessageName = "mouse left "
elif event.detail == 3:
MessageName = "mouse right "
elif event.detail == 2:
MessageName = "mouse middle "
elif event.detail == 5:
MessageName = "mouse wheel down "
elif event.detail == 4:
MessageName = "mouse wheel up "
else:
MessageName = "mouse " + str(event.detail) + " "
if event.type == X.ButtonPress:
MessageName = MessageName + "down"
elif event.type == X.ButtonRelease:
MessageName = MessageName + "up"
return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName)
示例2: makemousehookevent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def makemousehookevent(self, event):
storewm = self.xwindowinfo()
if event.detail == 1:
MessageName = "mouse left "
elif event.detail == 3:
MessageName = "mouse right "
elif event.detail == 2:
MessageName = "mouse middle "
elif event.detail == 5:
MessageName = "mouse wheel down "
elif event.detail == 4:
MessageName = "mouse wheel up "
else:
MessageName = "mouse " + str(event.detail) + " "
if event.type == X.ButtonPress:
MessageName = MessageName + "down"
elif event.type == X.ButtonRelease:
MessageName = MessageName + "up"
return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"],
(self.mouse_position_x, self.mouse_position_y), MessageName)
示例3: makemousehookevent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def makemousehookevent(self, event):
storewm = self.xwindowinfo()
if event.detail == 1:
MessageName = "mouse left "
elif event.detail == 3:
MessageName = "mouse right "
elif event.detail == 2:
MessageName = "mouse middle "
elif event.detail == 5:
MessageName = "mouse wheel down "
elif event.detail == 4:
MessageName = "mouse wheel up "
else:
MessageName = "mouse " + str(event.detail) + " "
if event.type == X.ButtonPress:
MessageName = MessageName + "down"
elif event.type == X.ButtonRelease:
MessageName = MessageName + "up"
else:
MessageName = "mouse moved"
return pyxhookmouseevent(storewm["handle"], storewm["name"], storewm["class"], (self.mouse_position_x, self.mouse_position_y), MessageName)
示例4: loop
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def loop(self):
current = None
while 1:
e = self.d.next_event()
# Window has been destroyed, quit
if e.type == X.DestroyNotify:
sys.exit(0)
# Button released, add or subtract
elif e.type == X.ButtonRelease:
if e.detail == 1:
print("Moving child window.")
self.childWindow.configure(
x=e.event_x - self.childWidth // 2,
y=e.event_y - self.childHeight // 2
)
self.d.flush()
# Somebody wants to tell us something
elif e.type == X.ClientMessage:
if e.client_type == self.WM_PROTOCOLS:
fmt, data = e.data
if fmt == 32 and data[0] == self.WM_DELETE_WINDOW:
sys.exit(0)
示例5: __sendMouseClick
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def __sendMouseClick(self, xCoord, yCoord, button, relative):
# Get current pointer position so we can return it there
pos = self.rootWindow.query_pointer()
if relative:
focus = self.localDisplay.get_input_focus().focus
focus.warp_pointer(xCoord, yCoord)
xtest.fake_input(focus, X.ButtonPress, button, x=xCoord, y=yCoord)
xtest.fake_input(focus, X.ButtonRelease, button, x=xCoord, y=yCoord)
else:
self.rootWindow.warp_pointer(xCoord, yCoord)
xtest.fake_input(self.rootWindow, X.ButtonPress, button, x=xCoord, y=yCoord)
xtest.fake_input(self.rootWindow, X.ButtonRelease, button, x=xCoord, y=yCoord)
self.rootWindow.warp_pointer(pos.root_x, pos.root_y)
self.__flush()
示例6: handle_event
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [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)
示例7: _mouseUp
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def _mouseUp(self, location: Location, button: str):
"""
Mouse button Up
:param location :x,y coordinates where to click
:param button 'left','middle','right'
"""
self.moveTo(location)
assert (
button in self.MOUSE_BUTTONS.keys()
), "button argument not in ('left', 'middle', 'right', 4, 5, 6, 7)"
button = self.MOUSE_BUTTONS[button]
fake_input(self.display, X.ButtonRelease, button)
self.display.sync()
示例8: processevents
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [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
示例9: _mouseUp
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def _mouseUp(x, y, button):
_moveTo(x, y)
assert button in BUTTON_NAME_MAPPING.keys(), "button argument not in ('left', 'middle', 'right', 4, 5, 6, 7)"
button = BUTTON_NAME_MAPPING[button]
fake_input(_display, X.ButtonRelease, button)
_display.sync()
示例10: makemousehookevent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def makemousehookevent(self, event):
storewm = self.xwindowinfo()
if event.detail == 1:
MessageName = "mouse left "
elif event.detail == 3:
MessageName = "mouse right "
elif event.detail == 2:
MessageName = "mouse middle "
elif event.detail == 5:
MessageName = "mouse wheel down "
elif event.detail == 4:
MessageName = "mouse wheel up "
else:
MessageName = "mouse {} ".format(event.detail)
if event.type == X.ButtonPress:
MessageName = "{} down".format(MessageName)
elif event.type == X.ButtonRelease:
MessageName = "{} up".format(MessageName)
else:
MessageName = "mouse moved"
return pyxhookmouseevent(
storewm["handle"],
storewm["name"],
storewm["class"],
(self.mouse_position_x, self.mouse_position_y),
MessageName
)
示例11: click_up
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def click_up(button): #Simulates a up click. Button is an int
Xlib.ext.xtest.fake_input(d,X.ButtonRelease, button)
d.sync()
示例12: mouse_click_up
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def mouse_click_up(button):
Xlib.ext.xtest.fake_input(d,X.ButtonRelease, button)
d.sync()
示例13: processevents
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [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
示例14: _getMouseEvent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [as 别名]
def _getMouseEvent():
screen = _display.screen()
window = screen.root
window.grab_pointer(1, X.PointerMotionMask|X.ButtonReleaseMask|X.ButtonPressMask, X.GrabModeAsync, X.GrabModeAsync, X.NONE, X.NONE, X.CurrentTime)
e = _display.next_event()
_display.ungrab_pointer(X.CurrentTime)
if e.type == X.ButtonPress:
e = MOUSE_EVENT[e.detail] + '_down'
elif e.type == X.ButtonRelease:
e = MOUSE_EVENT[e.detail] + '_up'
else:
e = 'moving'
return e
示例15: processevents
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import ButtonRelease [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