当前位置: 首页>>代码示例>>Python>>正文


Python key.ENTER属性代码示例

本文整理汇总了Python中pyglet.window.key.ENTER属性的典型用法代码示例。如果您正苦于以下问题:Python key.ENTER属性的具体用法?Python key.ENTER怎么用?Python key.ENTER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在pyglet.window.key的用法示例。


在下文中一共展示了key.ENTER属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pyglet_key_down

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def pyglet_key_down(self, symbol, modifier, repeat_in=0.3):
        from pyglet.window import key
        self.last_key_down = symbol
        self.last_key_modifier = modifier
        self.next_key_repeat = time.time() + repeat_in
        is_ascii = 27 <= symbol < 255
        char = {
            key.LEFT: KEYS.LEFT_ARROW,
            key.RIGHT: KEYS.RIGHT_ARROW,
            key.UP: KEYS.UP_ARROW,
            key.DOWN: KEYS.DOWN_ARROW,
            key.ENTER: '\r',
            key.RETURN: '\r',
            key.BACKSPACE: chr(127),
        }.get(symbol, chr(symbol) if is_ascii else None)
        if not char:
            # All other characters don't count as a key press
            # (e.g., function keys, modifier keys, etc.)
            return
        if modifier & key.MOD_SHIFT:
            char = char.upper()
        self.set_needs_display()
        self.handle_input(char) 
开发者ID:PartnershipOnAI,项目名称:safelife,代码行数:25,代码来源:interactive_game.py

示例2: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(self, symbol, modifiers):
        if symbol == key._1:
            self.apply = not self.apply
            with self.shader:
                self.shader.uniformi("iApply", self.apply)

        if symbol == key._2:
            self.hyperbolic = not self.hyperbolic
            with self.shader:
                self.shader.uniformi("iHyperbolic", self.hyperbolic)

        if symbol == key._3:
            self.elliptic = not self.elliptic
            with self.shader:
                self.shader.uniformi("iElliptic", self.elliptic)

        if symbol == key.V and (modifiers & key.LCTRL):
            self.switch_video()

        if symbol == key.ENTER:
            self.save_screenshot()

        if symbol == key.ESCAPE:
            pyglet.app.exit() 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:26,代码来源:Mobius_in_H3space.py

示例3: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(self, symbol, modifiers):
        """Event handler for the Window.on_key_press event."""
        if symbol == key.ENTER:
            self.scene_manager.change_scene('GameScene')
        elif symbol == key.ESCAPE:
            self.window.set_exclusive_mouse(False)
            return pyglet.event.EVENT_HANDLED

        if symbol in (key._1, key._2, key._3):
            if symbol == key._1:
                self.scene_manager.save.save_slot = 1
            elif symbol == key._2:
                self.scene_manager.save.save_slot = 2
            elif symbol == key._3:
                self.scene_manager.save.save_slot = 3
            self._highlight_save_slot() 
开发者ID:XenonLab-Studio,项目名称:TerraCraft,代码行数:18,代码来源:scenes.py

示例4: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(self, symbol, modifiers):
        """
        Keyboard interface.
        """
        if symbol == key.ENTER:
            self.save_screenshot()

        if symbol == key.ESCAPE:
            pyglet.app.exit() 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:11,代码来源:example_wythoff_shader_animation.py

示例5: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(self, symbol, modifiers):
        """Keyboard interface.
        """
        if symbol == key.ENTER:
            self.save_screenshot()

        if symbol == key.ESCAPE:
            pyglet.app.exit()

        if symbol == key.S and (modifiers & key.LCTRL):
            scene_file = load()
            self.shader = Shader(["./glsl/fractal3d.vert"], [scene_file])
            self.init_shader() 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:15,代码来源:fractal3d.py

示例6: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(self, symbol, modifiers):
        """Keyboard interface.
        """
        if symbol == key.ENTER:
            self.save_screenshot()

        if symbol == key.ESCAPE:
            pyglet.app.exit() 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:10,代码来源:example_wythoff_shader_animation.py

示例7: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(self, symbol, modifiers):
        if symbol == key.ENTER:
            self.save_screenshot()

        if symbol == key.ESCAPE:
            pyglet.app.exit() 
开发者ID:neozhaoliang,项目名称:pywonderland,代码行数:8,代码来源:loxodrome.py

示例8: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(symbol, modifiers):
    print("key %s was pressed" % symbol)
    if symbol == key.A:
        print('The "A" key was pressed.')
    elif symbol == key.LEFT:
        print('The left arrow key was pressed.')
    elif symbol == key.ENTER:
        print('The enter key was pressed.') 
开发者ID:Akagi201,项目名称:learning-python,代码行数:10,代码来源:events.py

示例9: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(symbol, modifiers):
    """
    This handler processes keyboard commands that
    control the simulation
    """

    if symbol == key.BACKSPACE or symbol == key.SLASH:
        print('RESET')
        env.reset()
        env.render('pyglet', view=view_mode)
        return

    if symbol == key.ESCAPE:
        env.close()
        sys.exit(0)

    if symbol == key.UP:
        step(env.actions.move_forward)
    elif symbol == key.DOWN:
        step(env.actions.move_back)

    elif symbol == key.LEFT:
        step(env.actions.turn_left)
    elif symbol == key.RIGHT:
        step(env.actions.turn_right)

    elif symbol == key.PAGEUP or symbol == key.P:
        step(env.actions.pickup)
    elif symbol == key.PAGEDOWN or symbol == key.D:
        step(env.actions.drop)

    elif symbol == key.ENTER:
        step(env.actions.done) 
开发者ID:maximecb,项目名称:gym-miniworld,代码行数:35,代码来源:manual_control.py

示例10: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(symbol, modifiers):
    if symbol == key.A:
        print 'The "A" key was pressed.'
    elif symbol == key.LEFT:
        print 'The left arrow key was pressed.'
    elif symbol == key.ENTER:
        print 'The enter key was pressed.' 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:9,代码来源:events.py

示例11: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(self, symbol, modifiers):
        if symbol == key.ENTER and self.activate_func:
            self.activate_func()
            if enable_sound:
                bullet_sound.play() 
开发者ID:shrimpboyho,项目名称:flappy-bird-py,代码行数:7,代码来源:astraea.py

示例12: on_key_press

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_press(symbol, modifiers):
    if symbol == key.A:
        print('The "A" key was pressed.')
    elif symbol == key.LEFT:
        print('The left arrow key was pressed.')
    elif symbol == key.ENTER:
        print('The enter key was pressed.') 
开发者ID:pyglet,项目名称:pyglet,代码行数:9,代码来源:events.py

示例13: on_key_release

# 需要导入模块: from pyglet.window import key [as 别名]
# 或者: from pyglet.window.key import ENTER [as 别名]
def on_key_release(self, symbol, modifiers):
        if symbol == key.ENTER and self.activate_func:
            self.activate_func()
            if enable_sound:
                bullet_sound.play() 
开发者ID:pyglet,项目名称:pyglet,代码行数:7,代码来源:astraea.py


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