Python pyglet.window.key.O Examples

The following are 2 code examples of pyglet.window.key.O(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyglet.window.key , or try the search function .
Example #1
Source File: main.py    From pywonderland with MIT License 5 votes vote down vote up
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.SPACE:
            self.clear_blank_window()

        if symbol == key.P:
            self.use_random_palette()

        if symbol == key.S and not modifiers:
            self.use_next_species()

        if symbol == key.S and (modifiers & key.LCTRL):
            self.save_config()

        if symbol == key.O and (modifiers & key.LCTRL):
            self.require_config_input()

        if symbol == key.V and (modifiers & key.LCTRL):
            self.switch_video() 
Example #2
Source File: renderfield.py    From pyglet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def on_key_press(symbol, modifiers):
    global enable_shader
    global enable_bidirectional
    global enable_antialias
    global enable_outline
    global enable_glow
    global outline_width
    global glow_width
    if symbol == key.S:
        enable_shader = not enable_shader
    elif symbol == key.B:
        enable_bidirectional = not enable_bidirectional
    elif symbol == key.A:
        enable_antialias = not enable_antialias
    elif symbol == key.O:
        enable_outline = not enable_outline
        enable_glow = False
    elif symbol == key.G:
        enable_glow = not enable_glow
        enable_outline = False
    elif symbol == key.PERIOD:
        if enable_glow:
            glow_width += 0.005
        else:
            outline_width += 0.005
    elif symbol == key.COMMA:
        if enable_glow:
            glow_width -= 0.005
        else:
            outline_width -= 0.005

    print('-' * 78)
    print('enable_shader', enable_shader)
    print('enable_bidirectional', enable_bidirectional)
    print('enable_antialias', enable_antialias)
    print('enable_outline', enable_outline)
    print('enable_glow', enable_glow)
    print('outline_width', outline_width)