documentation indexreference manualfunction index

name

Function: ui.keymap (**keymap):

This is a pseudo-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 indexreference manualfunction index