• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python key.modifiers_string函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyglet.window.key.modifiers_string函数的典型用法代码示例。如果您正苦于以下问题:Python modifiers_string函数的具体用法?Python modifiers_string怎么用?Python modifiers_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了modifiers_string函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:Faore,项目名称:bin-packing,代码行数:12,代码来源:ez.py


示例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)
开发者ID:Faore,项目名称:bin-packing,代码行数:12,代码来源:ez.py


示例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
开发者ID:stonewell,项目名称:pymterm,代码行数:25,代码来源:window_base.py


示例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))
开发者ID:npalermo10,项目名称:holocube,代码行数:7,代码来源:windows.py


示例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
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:8,代码来源:WINDOW_SET_EXCLUSIVE_KEYBOARD.py


示例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)
开发者ID:Faore,项目名称:bin-packing,代码行数:11,代码来源:ez.py


示例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)
开发者ID:Faore,项目名称:bin-packing,代码行数:12,代码来源:ez.py


示例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)
开发者ID:Faore,项目名称:bin-packing,代码行数:12,代码来源:ez.py


示例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
开发者ID:chicken-mover,项目名称:black-mango,代码行数:15,代码来源:keyboard.py


示例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))
开发者ID:2bam,项目名称:afe,代码行数:45,代码来源:gui.py


示例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
开发者ID:chicken-mover,项目名称:delta-v,代码行数:24,代码来源:keyboard.py


示例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)))
开发者ID:bitcraft,项目名称:pyglet,代码行数:3,代码来源:event_button.py


示例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)
开发者ID:ajhager,项目名称:copycat,代码行数:4,代码来源:event.py


示例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)
开发者ID:ajhager,项目名称:copycat,代码行数:5,代码来源:event.py


示例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)
开发者ID:ajhager,项目名称:copycat,代码行数:3,代码来源:event.py


示例16: __str__

 def __str__(self):
     return key.symbol_string(self.key) + ' ' + key.modifiers_string(self.modifiers)
开发者ID:hakuji,项目名称:game3,代码行数:2,代码来源:util.py


示例17: on_key_press

 def on_key_press(self, symbol, modifiers):
     print >> self.file, 'on_key_press(symbol=%s, modifiers=%s)' % (
         key.symbol_string(symbol), key.modifiers_string(modifiers))
开发者ID:Aang,项目名称:sympy,代码行数:3,代码来源:event.py


示例18: on_mouse_press

 def on_mouse_press(self, x, y, button, modifiers):
     print >> self.file, 'on_mouse_press(x=%d, y=%d, button=%r, '\
                         'modifiers=%s)' % (x, y,
         mouse.buttons_string(button), key.modifiers_string(modifiers))
开发者ID:Aang,项目名称:sympy,代码行数:4,代码来源:event.py


示例19: on_key_release

 def on_key_release(self, symbol, modifiers):
     print 'Released %s with modifiers %s' % \
         (key.symbol_string(symbol), key.modifiers_string(modifiers))
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:3,代码来源:WINDOW_SET_EXCLUSIVE_KEYBOARD.py


示例20: on_mouse_release

 def on_mouse_release(self, x, y, button, modifiers):
     print 'Mouse button %d released at %f,%f with %s' % \
         (button, x, y, key.modifiers_string(modifiers))
开发者ID:DatRollingStone,项目名称:nwidget,代码行数:3,代码来源:EVENT_BUTTON.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python key.symbol_string函数代码示例发布时间:2022-05-25
下一篇:
Python window.Window类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap