本文整理汇总了Python中Xlib.XK.keysym_to_string方法的典型用法代码示例。如果您正苦于以下问题:Python XK.keysym_to_string方法的具体用法?Python XK.keysym_to_string怎么用?Python XK.keysym_to_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xlib.XK
的用法示例。
在下文中一共展示了XK.keysym_to_string方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listen
# 需要导入模块: from Xlib import XK [as 别名]
# 或者: from Xlib.XK import keysym_to_string [as 别名]
def listen(self):
self.grab()
while True:
evt = self.disp.next_event()
if evt.type in [X.KeyPress, X.KeyRelease]:
keycode = evt.detail
keysym = self.disp.keycode_to_keysym(keycode, 0)
char = XK.keysym_to_string(keysym)
self.disp.allow_events(X.ReplayKeyboard, X.CurrentTime)
self.mode(self, evt, char)
if evt.type == X.DestroyNotify:
if evt.window.id == self.id:
self.ungrab()
return
示例2: event_to_string
# 需要导入模块: from Xlib import XK [as 别名]
# 或者: from Xlib.XK import keysym_to_string [as 别名]
def event_to_string(self, event):
mods = []
if event.state & X.ShiftMask:
mods.append('Shift')
if event.state & X.ControlMask:
mods.append('Control')
keycode = event.detail
keysym = self.disp.keycode_to_keysym(keycode, 0)
char = XK.keysym_to_string(keysym)
return ''.join(mod + '+' for mod in mods) + (char if char else '?')
示例3: mousemoveevent
# 需要导入模块: from Xlib import XK [as 别名]
# 或者: from Xlib.XK import keysym_to_string [as 别名]
def mousemoveevent(self, event):
self.mouse_position_x = event.root_x
self.mouse_position_y = event.root_y
# need the following because XK.keysym_to_string() only does printable chars
# rather than being the correct inverse of XK.string_to_keysym()
示例4: mousemoveevent
# 需要导入模块: from Xlib import XK [as 别名]
# 或者: from Xlib.XK import keysym_to_string [as 别名]
def mousemoveevent(self, event):
self.mouse_position_x = event.root_x
self.mouse_position_y = event.root_y
return self.makemousehookevent(event)
# need the following because XK.keysym_to_string() only does printable
# chars rather than being the correct inverse of XK.string_to_keysym()
示例5: mousemoveevent
# 需要导入模块: from Xlib import XK [as 别名]
# 或者: from Xlib.XK import keysym_to_string [as 别名]
def mousemoveevent(self, event):
self.mouse_position_x = event.root_x
self.mouse_position_y = event.root_y
return self.makemousehookevent(event)
# need the following because XK.keysym_to_string() only does printable chars
# rather than being the correct inverse of XK.string_to_keysym()