

def on_key_press(self, event):
    if (event.key == 'q'):
        self.show(False, False)
        self.app.quit()
        return
    elif ((event.key == 'p') or (event.key == ' ')):
        self._paused = (not self._paused)
        self.update_timer_state()
    elif (event.key == 's'):
        img = _screenshot()
        self.write_img(img)
    elif (event.key == 'a'):
        print(('Size/pos args: --size %dx%d --pos %d,%d' % (self.physical_size[0], self.physical_size[1], self.position[0], self.position[1])))
    elif (event.key == 'f'):
        self._profile = (not self._profile)
        if self._profile:

            def print_profile(fps):
                print(('%.2f ms/frame' % (1000.0 / float(fps))))
                return False
            self.measure_fps(1.0, print_profile)
        else:
            self.measure_fps(1.0, False)
        self.update_timer_state()
    elif ((event.key == keys.LEFT) or (event.key == keys.RIGHT)):
        img._paused = True
        self.update_timer_state()
        step = (1.0 / 60.0)
        if (keys.ALT in event.modifiers):
            step *= 0.1
            if (keys.SHIFT in event.modifiers):
                step *= 0.1
        else:
            if (keys.SHIFT in event.modifiers):
                step *= 10.0
            if (keys.CONTROL in event.modifiers):
                step *= 100.0
        if (event.key == keys.LEFT):
            step *= (- 1.0)
        self.program['iGlobalTime'] += step
        self.print_t()
        self.update()

dataset/ETHPy150Open alexjc/shadertoy-render/shadertoy-render.py RenderingCanvas.on_key_press/VarMisuse@270/342 `self`->`img`