renpy/doc/reference/functions/ui.keymap - Ren'Py

documentation index ◦ reference manual ◦ function index

# name

Function: | ui.keymap | (**keymap):

This is a psuedo-widget that adds a keymap to the screen. This function takes as keyword arguments the names of bindings or keysyms. These keywords should be given as their arguments a function, which is called with zero arguments when an appropriate keysym is pressed.

## Example

This example lets the player press the (uppercase) W key at any point to see the easter egg, by assigning a function to the keyword argument `W`. To bind to a normal lowercase w, the binding `w` or keysym `K_w` would be used. A full list of keysyms may be found here.

    label easter_egg:
        "You win!"
        return

    init:
        python hide:
             def overlay():
                 ui.keymap(W=renpy.curried_call_in_new_context("easter_egg"))

             config.overlay_functions.append(overlay)

documentation index ◦ reference manual ◦ function index