本文整理汇总了Python中pyglet.window.key.modifiers_string函数的典型用法代码示例。如果您正苦于以下问题:Python modifiers_string函数的具体用法?Python modifiers_string怎么用?Python modifiers_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了modifiers_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_key_press
def on_key_press(self, symbol, modifiers):
letter = key.symbol_string(symbol)
if self.verbose:
print("press:",letter,key.modifiers_string(modifiers))
_keyboard.add(key.symbol_string(symbol))
if self.keypress is not None:
kwargs = {
"window":self,
"symbol":key.symbol_string(symbol),
"modifiers":key.modifiers_string(modifiers)
}
self.keypress(**kwargs)
示例2: on_key_release
def on_key_release(self, symbol, modifiers):
letter = key.symbol_string(symbol)
if self.verbose: print("release:",letter,key.modifiers_string(modifiers))
_keyboard.remove(key.symbol_string(symbol))
if self.keyrelease is not None:
kwargs = {
"window":self,
"symbol":key.symbol_string(symbol),
"modifiers":key.modifiers_string(modifiers)
}
self.keyrelease(**kwargs)
示例3: on_key_press
def on_key_press(self, symbol, modifiers):
if pymterm.debug_log:
LOGGER.debug('on_key_press:{}, {}'.format(
key.symbol_string(symbol),
key.modifiers_string(modifiers)))
key_state = KeyState(symbol, modifiers)
if symbol == key.Q and \
(modifiers == key.MOD_COMMAND or modifiers == key.MOD_CTRL):
self.close()
return
if self.session.terminal.process_key(key_state):
if pymterm.debug_log:
LOGGER.debug(' processed by pyterm')
return
v, handled = term.term_keyboard.translate_key(self.session.terminal,
key_state)
if len(v) > 0:
self.session.send(v)
self._key_first_down = True
示例4: print_keypress_actions
def print_keypress_actions(self):
items = sorted(self.keypress_actions.items())
for keypress, action in items:
keysymbol = key.symbol_string(keypress[0]).lstrip(' _')
modifiers = key.modifiers_string(keypress[1]).replace('MOD_', '').replace('|', ' ').lstrip(' ')
func, args, kwargs = action[0].__name__, action[1], action[2]
print('{:<10} {:<6} --- {:<30}({}, {})'.format(modifiers, keysymbol, func, args, kwargs))
示例5: on_key_press
def on_key_press(self, symbol, modifiers):
print 'Pressed %s with modifiers %s' % \
(key.symbol_string(symbol), key.modifiers_string(modifiers))
if symbol == key.E:
exclusive = not (modifiers & key.MOD_SHIFT)
self.w.set_exclusive_keyboard(exclusive)
print 'Exclusive keyboard is now %r' % exclusive
示例6: on_mouse_drag
def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
if self.verbose:
print("drag")
if self.mousedrag is not None:
kwargs = {
"window":self,
"posn":(x,y),
"button":button,
"modifiers":key.modifiers_string(modifiers)
}
self.mousedrag(**kwargs)
示例7: on_mouse_release
def on_mouse_release(self, x, y, button, modifiers):
if self.verbose:
print("release")
_mouse.remove(_button_string(button))
if self.mouserelease is not None:
kwargs = {
"window":self,
"posn":(x,y),
"button":_button_string(button),
"modifiers":key.modifiers_string(modifiers)
}
self.mouserelease(**kwargs)
示例8: on_mouse_press
def on_mouse_press(self, x, y, button, modifiers):
if self.verbose:
print("press")
_mouse.add(_button_string(button))
if self.mousepress is not None:
kwargs = {
"window":self,
"posn":(x,y),
"button":_button_string(button),
"modifiers":key.modifiers_string(modifiers)
}
self.mousepress(**kwargs)
示例9: check
def check(binding):
possible_keys = bindings.get(binding)
for keyset in possible_keys:
try:
sym, mods = keyset
except TypeError:
sym = keyset
mods = 0
allk = [sym,]
# TODO: the modifiers code isn't working properly
mods = key.modifiers_string(mods)
for m in filter(None, mods.split('|')):
allk.append(getattr(key, m))
pressedk = filter(lambda x: blackmango.ui.game_window.keyboard[x], allk)
return pressedk == allk
示例10: on_key_press
def on_key_press(symbol, modifiers):
global selected
global process
global game_running
if symbol == key.UP:
selected = (selected - 1) % len(game_infos)
refresh()
elif symbol == key.DOWN:
selected = (selected + 1) % len(game_infos)
refresh()
elif symbol == key.F and (modifiers&key.MOD_ALT) != 0:
#window.set_fullscreen(not window.fullscreen, **mconf.window_size)
pass
elif symbol == key.ESCAPE:
kill_proc()
raise SystemExit()
elif symbol == key.RETURN:
kill_proc()
exec = game_infos[selected]['execute']
if exec:
exec_dir = os.path.join(mconf.games_folder, game_infos[selected]['name'])
print(_('Ejecutando [{exe}] con CWD=[{cwd}]').format(exe=exec, cwd=exec_dir))
exec_list = shlex.split(exec, posix=True)
exec_list[0] = os.path.join(exec_dir, exec_list[0])
print(exec_list)
try:
#Windows hack: Give focus to window TODO: is this still needed?
#windows-only
si = subprocess.STARTUPINFO()
si.dwFlags = subprocess.STARTF_USESHOWWINDOW
SW_SHOW = 5
si.wShowWindow = SW_SHOW
process = subprocess.Popen(exec_list, cwd=exec_dir, startupinfo=si)
last_input = 0
game_running = game_infos[selected]['name']
# gui.process = subprocess.Popen(exec_path, cwd=exec_dir)
print(_('OK'))
except:
print(_('ERROR AL EJECUTAR: ') + str(sys.exc_info()[0]))
process = None
game_running = None
print('A key was pressed sym=' + key.symbol_string(symbol) + ' mod=' + key.modifiers_string(modifiers))
示例11: check
def check(binding):
"""
Check *binding* to see if it is being pressed at the moment. The value of
*binding* should be one of the keys in :data:`bindings`.
"""
possible_keys = bindings.get(binding)
try:
iter(possible_keys)
except TypeError:
possible_keys = [possible_keys,]
for keyset in possible_keys:
try:
sym, mods = keyset
except TypeError:
sym = keyset
mods = 0
allk = [sym,]
# TODO: the modifiers code isn't working properly
mods = key.modifiers_string(mods)
for m in filter(None, mods.split('|')):
allk.append(getattr(key, m))
pressedk = filter(lambda x: deltav.ui.game_window.keyboard[x], allk)
pressedk = list(pressedk)
return pressedk == allk
示例12: on_mouse_press
def on_mouse_press(self, x, y, button, modifiers):
print('Mouse button %d pressed at %f,%f with %s' %
(button, x, y, key.modifiers_string(modifiers)))
示例13: on_mouse_release
def on_mouse_release(self, x, y, button, modifiers):
print('on_mouse_release(x=%d, y=%d, button=%r, '\
'modifiers=%s)' % (x, y,
mouse.buttons_string(button), key.modifiers_string(modifiers)), file=self.file)
示例14: on_mouse_drag
def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
print('on_mouse_drag(x=%d, y=%d, dx=%d, dy=%d, '\
'buttons=%s, modifiers=%s)' % (
x, y, dx, dy,
mouse.buttons_string(buttons), key.modifiers_string(modifiers)), file=self.file)
示例15: on_key_release
def on_key_release(self, symbol, modifiers):
print('on_key_release(symbol=%s, modifiers=%s)' % (
key.symbol_string(symbol), key.modifiers_string(modifiers)), file=self.file)