Text Input link

With some limitations, Ren'Py can prompt the user to input a small amount of text. This prompting is done by the renpy.input() function, which returns the entered text, allowing it to be saved in a variable or otherwise processed.

On Linux, text input is limited to languages that do not require input method (IME) support. Most Western languages should work, but Chinese, Japanese, and Korean probably won't.

The renpy.input function is defined as:

renpy.input(prompt, default='', allow=None, exclude='{}', length=None, with_none=None, pixel_width=None, screen='input') link

Calling this function pops up a window asking the player to enter some text. It returns the entered text.

A string giving a prompt to display to the player.
A string giving the initial text that will be edited by the player.
If not None, a string giving a list of characters that will be allowed in the text.
If not None, if a character is present in this string, it is not allowed in the text.
If not None, this must be an integer giving the maximum length of the input string.
If not None, the input is limited to being this many pixels wide, in the font used by the input to display text.
The name of the screen that takes input. If not given, the input screen is used.

If config.disable_input is True, this function only returns default.

Games that use renpy.input will often want to process the result further, using standard Python string manipulation functions. For example, the following will ask the player for his or her name and remove leading or trailing whitespace. If the name is empty, it will be replaced by a default name. Finally, it is displayed to the user.

define pov = Character("[povname]")

    povname = renpy.input("What is your name?")
    povname = povname.strip()

    if not povname:
         povname = "Pat Smith"

pov "My name is [povname]!"