renpy/doc/screens.html

2262 lines
169 KiB
HTML
Raw Normal View History

2023-01-18 22:13:55 +00:00
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Screens and Screen Language &#8212; Ren&#39;Py Documentation</title>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-3.3.6/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="_static/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Screen Actions, Values, and Functions" href="screen_actions.html" />
<link rel="prev" title="Style Properties" href="style_properties.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head><body>
<div id="navbar" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
Ren&#39;Py Documentation</a>
<span class="navbar-text navbar-version pull-left"><b>7.5.3</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li><a href="https://www.renpy.org">Home Page</a></li>
<li><a href="https://www.renpy.org/doc/html/">Online Documentation</a></li>
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="quickstart.html">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui.html">GUI Customization Guide</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="language_basics.html">Language Basics</a></li>
<li class="toctree-l1"><a class="reference internal" href="label.html">Labels &amp; Control Flow</a></li>
<li class="toctree-l1"><a class="reference internal" href="dialogue.html">Dialogue and Narration</a></li>
<li class="toctree-l1"><a class="reference internal" href="displaying_images.html">Displaying Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="menus.html">In-Game Menus</a></li>
<li class="toctree-l1"><a class="reference internal" href="python.html">Python Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="conditional.html">Conditional Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="audio.html">Audio</a></li>
<li class="toctree-l1"><a class="reference internal" href="movie.html">Movie</a></li>
<li class="toctree-l1"><a class="reference internal" href="voice.html">Voice</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="text.html">Text</a></li>
<li class="toctree-l1"><a class="reference internal" href="translation.html">Translation</a></li>
<li class="toctree-l1"><a class="reference internal" href="displayables.html">Displayables</a></li>
<li class="toctree-l1"><a class="reference internal" href="transforms.html">Transforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="transitions.html">Transitions</a></li>
<li class="toctree-l1"><a class="reference internal" href="atl.html">Animation and Transformation Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="matrixcolor.html">Matrixcolor</a></li>
<li class="toctree-l1"><a class="reference internal" href="layeredimage.html">Layered Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="3dstage.html">3D Stage</a></li>
<li class="toctree-l1"><a class="reference internal" href="live2d.html">Live2D Cubism</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="style.html">Styles</a></li>
<li class="toctree-l1"><a class="reference internal" href="style_properties.html">Style Properties</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Screens and Screen Language</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_actions.html">Screen Actions, Values, and Functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_special.html">Special Screen Names</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_optimization.html">Screen Language Optimization</a></li>
<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="preferences.html">Preference Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="store_variables.html">Store Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="mouse.html">Custom Mouse Cursors</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="launcher.html">Launcher</a></li>
<li class="toctree-l1"><a class="reference internal" href="developer_tools.html">Developer Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="director.html">Interactive Director</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="nvl_mode.html">NVL-Mode Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="input.html">Text Input</a></li>
<li class="toctree-l1"><a class="reference internal" href="side_image.html">Side Images</a></li>
<li class="toctree-l1"><a class="reference internal" href="rooms.html">Image Gallery, Music Room, and Replay Actions</a></li>
<li class="toctree-l1"><a class="reference internal" href="drag_drop.html">Drag and Drop</a></li>
<li class="toctree-l1"><a class="reference internal" href="sprites.html">Sprites</a></li>
<li class="toctree-l1"><a class="reference internal" href="keymap.html">Customizing the Keymap</a></li>
<li class="toctree-l1"><a class="reference internal" href="achievement.html">Achievements</a></li>
<li class="toctree-l1"><a class="reference internal" href="history.html">Dialogue History</a></li>
<li class="toctree-l1"><a class="reference internal" href="multiple.html">Multiple Character Dialogue</a></li>
<li class="toctree-l1"><a class="reference internal" href="splashscreen_presplash.html">Splashscreen and Presplash</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="statement_equivalents.html">Statement Equivalents</a></li>
<li class="toctree-l1"><a class="reference internal" href="save_load_rollback.html">Saving, Loading, and Rollback</a></li>
<li class="toctree-l1"><a class="reference internal" href="persistent.html">Persistent Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="trans_trans_python.html">Transforms and Transitions in Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="gui_advanced.html">Advanced GUI</a></li>
<li class="toctree-l1"><a class="reference internal" href="screen_python.html">Screens and Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="modes.html">Modes</a></li>
<li class="toctree-l1"><a class="reference internal" href="cdd.html">Creator-Defined Displayables</a></li>
<li class="toctree-l1"><a class="reference internal" href="cds.html">Creator-Defined Statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="custom_text_tags.html">Custom Text Tags</a></li>
<li class="toctree-l1"><a class="reference internal" href="character_callbacks.html">Character Callbacks</a></li>
<li class="toctree-l1"><a class="reference internal" href="file_python.html">File Access</a></li>
<li class="toctree-l1"><a class="reference internal" href="color_class.html">Color Class</a></li>
<li class="toctree-l1"><a class="reference internal" href="matrix.html">Matrix</a></li>
<li class="toctree-l1"><a class="reference internal" href="model.html">Model-Based Rendering</a></li>
<li class="toctree-l1"><a class="reference internal" href="other.html">Other Functions and Variables</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="build.html">Building Distributions</a></li>
<li class="toctree-l1"><a class="reference internal" href="updater.html">Web Updater</a></li>
<li class="toctree-l1"><a class="reference internal" href="android.html">Android</a></li>
<li class="toctree-l1"><a class="reference internal" href="chromeos.html">Chrome OS/Chromebook</a></li>
<li class="toctree-l1"><a class="reference internal" href="ios.html">iOS</a></li>
<li class="toctree-l1"><a class="reference internal" href="iap.html">In-App Purchasing</a></li>
<li class="toctree-l1"><a class="reference internal" href="gesture.html">Gestures</a></li>
<li class="toctree-l1"><a class="reference internal" href="raspi.html">Raspberry Pi</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="security.html">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="problems.html">Dealing with Problems</a></li>
<li class="toctree-l1"><a class="reference internal" href="environment_variables.html">Environment Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="self_voicing.html">Self-Voicing</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="editor.html">Text Editor Integration</a></li>
<li class="toctree-l1"><a class="reference internal" href="skins.html">Skins</a></li>
<li class="toctree-l1"><a class="reference internal" href="translating_renpy.html">Translating Ren'Py</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog (Ren'Py 7.x-)</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog6.html">Changelog (Ren'Py 6.11 - 6.99)</a></li>
<li class="toctree-l1"><a class="reference internal" href="incompatible.html">Incompatible Changes</a></li>
<li class="toctree-l1"><a class="reference internal" href="distributor.html">Distributor Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
<li class="toctree-l1"><a class="reference internal" href="credits.html">Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="sponsors.html">Ren'Py Development Sponsors</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="thequestion.html">Script of The Question</a></li>
<li class="toctree-l1"><a class="reference internal" href="thequestion_nvl.html">NVL-mode script for The Question</a></li>
</ul>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-3">
<div id="sidebar" class="bs-sidenav" role="complementary"><ul>
<li><a class="reference internal" href="#">Screens and Screen Language</a><ul>
<li><a class="reference internal" href="#screen-language">Screen Language</a><ul>
<li><a class="reference internal" href="#screen-language-syntax">Screen Language Syntax</a></li>
<li><a class="reference internal" href="#screen-statement">Screen Statement</a></li>
</ul>
</li>
<li><a class="reference internal" href="#user-interface-statements">User Interface Statements</a><ul>
<li><a class="reference internal" href="#bar">Bar</a></li>
<li><a class="reference internal" href="#button">Button</a></li>
<li><a class="reference internal" href="#dismiss">Dismiss</a></li>
<li><a class="reference internal" href="#fixed">Fixed</a></li>
<li><a class="reference internal" href="#frame">Frame</a></li>
<li><a class="reference internal" href="#grid">Grid</a></li>
<li><a class="reference internal" href="#hbox">Hbox</a></li>
<li><a class="reference internal" href="#imagebutton">Imagebutton</a></li>
<li><a class="reference internal" href="#input">Input</a></li>
<li><a class="reference internal" href="#key">Key</a></li>
<li><a class="reference internal" href="#label">Label</a></li>
<li><a class="reference internal" href="#sl-mousearea">Mousearea</a></li>
<li><a class="reference internal" href="#nearrect">Nearrect</a></li>
<li><a class="reference internal" href="#null">Null</a></li>
<li><a class="reference internal" href="#side">Side</a></li>
<li><a class="reference internal" href="#text">Text</a></li>
<li><a class="reference internal" href="#textbutton">Textbutton</a></li>
<li><a class="reference internal" href="#timer">Timer</a></li>
<li><a class="reference internal" href="#transform">Transform</a></li>
<li><a class="reference internal" href="#vbar">Vbar</a></li>
<li><a class="reference internal" href="#vbox">Vbox</a></li>
<li><a class="reference internal" href="#viewport">Viewport</a></li>
<li><a class="reference internal" href="#vpgrid">Vpgrid</a></li>
<li><a class="reference internal" href="#window">Window</a></li>
</ul>
</li>
<li><a class="reference internal" href="#imagemap-statements">Imagemap Statements</a><ul>
<li><a class="reference internal" href="#imagemap">Imagemap</a></li>
<li><a class="reference internal" href="#hotspot">Hotspot</a></li>
<li><a class="reference internal" href="#hotbar">Hotbar</a></li>
</ul>
</li>
<li><a class="reference internal" href="#add-statement">Add Statement</a><ul>
<li><a class="reference internal" href="#add">Add</a></li>
</ul>
</li>
<li><a class="reference internal" href="#advanced-displayables">Advanced Displayables</a></li>
<li><a class="reference internal" href="#has-statement">Has Statement</a></li>
<li><a class="reference internal" href="#control-statements">Control Statements</a><ul>
<li><a class="reference internal" href="#default">Default</a></li>
<li><a class="reference internal" href="#for">For</a></li>
<li><a class="reference internal" href="#if">If</a></li>
<li><a class="reference internal" href="#on">On</a></li>
<li><a class="reference internal" href="#use">Use</a><ul>
<li><a class="reference internal" href="#use-and-transclude">Use and Transclude</a></li>
</ul>
</li>
<li><a class="reference internal" href="#python">Python</a></li>
</ul>
</li>
<li><a class="reference internal" href="#showif-statement">Showif Statement</a></li>
<li><a class="reference internal" href="#screen-statements">Screen Statements</a><ul>
<li><a class="reference internal" href="#show-screen">Show Screen</a></li>
<li><a class="reference internal" href="#hide-screen">Hide Screen</a></li>
<li><a class="reference internal" href="#call-screen">Call Screen</a></li>
</ul>
</li>
<li><a class="reference internal" href="#screen-variants">Screen Variants</a></li>
<li><a class="reference internal" href="#see-also">See also</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="col-md-9 content">
<div class="section" id="screens-and-screen-language">
<span id="screens"></span><h1>Screens and Screen Language<a class="headerlink" href="#screens-and-screen-language" title="Permalink to this headline"> link</a></h1>
<p>The things that a user sees when looking at a Ren'Py game can be
divided into images and user interface. Images are displayed to
the user using the scene, show, and hide statements, and are generally
part of the story being told. Everything else the user sees is part of
the user interface, which is customized using screens.</p>
<p>Screens can be displayed in four ways:</p>
<ul class="simple">
<li>Implicitly, when script statements execute. For example,
the say statement will cause the <cite>say</cite> screen to be displayed.</li>
<li>Automatically. For example, Ren'Py will display the <cite>main_menu</cite>
screen when it starts running, or when the user returns to the
main menu.</li>
<li>As an action, associated with a button, mouse button, or keyboard
key. By default, the <cite>save</cite> screen is shown when the user
right-clicks or presses escape. It's also possible to define an
on-screen button that shows the <cite>save</cite> screen.</li>
<li>Explicitly, using statements that cause screens to be shown.</li>
</ul>
<p>More than one screen can be shown at a time.</p>
<p>Screens have two main functions. The first is to display information
to the user. Information can be displayed using text, bars, and
images. Some of the information displayed in this manner is vital to
gameplay. The <cite>say</cite> screen, for example, is used to display dialogue
to the user, including the character's name and what she is saying.</p>
<p>The other thing a screen can do is to allow the user to interact with
the game. Buttons and bars allow the user to invoke actions and adjust
values. Ren'Py includes a pool of pre-defined actions, allowing the
user to advance the game, control preferences, load and save games,
and invoke many other actions. A game-maker can also write new actions
in Python.</p>
<p>Screens are updated at the start of each interaction, and each time an
interaction is restarted. Note that a <code class="docutils literal notranslate"><span class="pre">with</span> <span class="pre">None</span></code> statement does not
cause an interaction to happen, and hence won't update a screen.</p>
<p>A screen has a scope associated with it, giving values to some
variables. When a variable is accessed by a screen, it's first looked
up in the scope, and then looked up as a global variable.</p>
<p><strong>Screens must not cause side effects that are visible from
outside the screen.</strong> Ren'Py will run a screen multiple times, as
it deems necessary. It runs a screen as part of the image
prediction process, before the screen is first shown. As a result, if
running a screen has side effects, those side effects may occur at
unpredictable times.</p>
<p><strong>Using Python generators in screens may cause unpredictable results.</strong>
This traces back to an issue with the way the Python interpreter compiles
Python source code that will be used in a screen context. Generators
can be used in Python functions called from a screen, but not in the
screen itself.</p>
<div class="section" id="screen-language">
<h2>Screen Language<a class="headerlink" href="#screen-language" title="Permalink to this headline"> link</a></h2>
<p>The screen language is a mostly-declarative way of displaying
screens. It consists of a statement that declares a new screen,
statements that add displayables to that screen, and control
statements.</p>
<p>Here's an example of a screen:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">say</span><span class="p">(</span><span class="n">who</span><span class="p">,</span> <span class="n">what</span><span class="p">):</span>
<span class="k">window</span> <span class="na">id</span> <span class="s2">&quot;window&quot;</span><span class="p">:</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="na">spacing</span> <span class="mi">10</span>
<span class="k">text</span> <span class="n">who</span> <span class="na">id</span> <span class="s2">&quot;who&quot;</span>
<span class="k">text</span> <span class="n">what</span> <span class="na">id</span> <span class="s2">&quot;what&quot;</span>
</pre></div>
</div>
<p>The first line of this is a screen statement, a Ren'Py language
statement that's used to declare a screen. The name of the screen is
<cite>say</cite>, so this is the screen that's used to display dialogue. It takes
two parameters, <cite>who</cite> and <cite>what</cite>.</p>
<p>The screen contains a window, which has been given the id of
&quot;window&quot;. This window contains a vertical box, and the spacing inside
that box is 10 pixels. It contains two text fields, one displaying the name of
the speaker, and the displaying what is being spoken.</p>
<div class="section" id="screen-language-syntax">
<h3>Screen Language Syntax<a class="headerlink" href="#screen-language-syntax" title="Permalink to this headline"> link</a></h3>
<p>Most screen language statements share a common syntax. (Some of the
control statements have other syntaxes.) A statement starts at the
beginning of a line, with a keyword that introduces the statement.</p>
<p>If a statement takes parameters, they immediately follow the
keyword. The parameters are space-separated simple expressions, unless
otherwise noted.</p>
<p>The positional parameters are followed by a property list. A property
consists of the property name, followed by the value of that
property. Property values are simple expressions, unless otherwise
noted. A property list is a space-separated list of these properties.</p>
<p>If a statement ends with a colon <code class="docutils literal notranslate"><span class="pre">:</span></code>, then it takes a block. Each line
in a block may be one of two things:</p>
<ul class="simple">
<li>A property list.</li>
<li>A screen language statement.</li>
</ul>
</div>
<div class="section" id="screen-statement">
<h3>Screen Statement<a class="headerlink" href="#screen-statement" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">screen</span></code> statement is a Ren'Py script language statement that is
used to declare a new screen. It is parsed using the screen language
common syntax.</p>
<p>It takes one parameter, the name of the screen. This is a name, not an
expression. It takes the following properties:</p>
<dl class="docutils">
<dt><cite>modal</cite></dt>
<dd>If True, the screen is modal. A modal screen prevents the user
from interacting with displayables below it, except
for the default keymap. This is evaluated once, when the
game starts.</dd>
<dt><cite>sensitive</cite></dt>
<dd>An expression that determines whether the screen is sensitive or not.
This expression is evaluated at least once per interaction.</dd>
<dt><cite>tag</cite></dt>
<dd>Parsed as a name, not an expression. This specifies a tag
associated with this screen. Showing a screen replaces other
screens with the same tag. This can be used to ensure that only
one screen of a menu is shown at a time, in the same context.</dd>
<dt><cite>zorder</cite></dt>
<dd>This controls how close to the user a screen is displayed. The
larger the number, the closer the screen is displayed to the
user. It defaults to 0.</dd>
<dt><cite>variant</cite></dt>
<dd>If present, this should be a string or list of strings giving the
variant of screen to be defined. See <a class="reference internal" href="#screen-variants"><span class="std std-ref">Screen Variants</span></a>.</dd>
<dt><cite>style_prefix</cite></dt>
<dd>A string that's used to provide a prefix for the style for the
children of this screen, as <a class="reference internal" href="#style-prefix"><span class="std std-ref">described below</span></a>.</dd>
<dt><cite>layer</cite></dt>
<dd>A string giving the name of the layer the screen is shown on by
default.</dd>
<dt><cite>roll_forward</cite></dt>
<dd><p class="first">If true, roll forward will be enabled when the screen is used in a
<code class="docutils literal notranslate"><span class="pre">call</span> <span class="pre">screen</span></code> statement. If false, roll forward is disabled, and
if None or not given, the value of <a class="reference internal" href="config.html#var-config.call_screen_roll_forward"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.call_screen_roll_forward</span></code></a>
is used.</p>
<p class="last">When roll forwarding from a <code class="docutils literal notranslate"><span class="pre">call</span> <span class="pre">screen</span></code> statement, return values
and terminal jumps are preserved, but other side effects will not
occur. This means that if the screen only contains <a class="reference internal" href="screen_actions.html#Jump" title="Jump"><code class="xref py py-func docutils literal notranslate"><span class="pre">Jump()</span></code></a>
and <a class="reference internal" href="screen_actions.html#Return" title="Return"><code class="xref py py-func docutils literal notranslate"><span class="pre">Return()</span></code></a> actions, it's safe to enable <cite>roll_forward</cite>. Other
actions may have side-effects that will not occur during the roll_forward.</p>
</dd>
</dl>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">hello_world</span><span class="p">():</span>
<span class="k">tag</span> <span class="n">example</span>
<span class="k">zorder</span> <span class="mi">1</span>
<span class="na">modal</span> <span class="kc">False</span>
<span class="k">text</span> <span class="s2">&quot;Hello, World.&quot;</span>
</pre></div>
</div>
<p>A screen can take a parameter list:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">center_text</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="na">size</span><span class="o">=</span><span class="mi">42</span><span class="p">):</span>
<span class="k">text</span> <span class="n">s</span> <span class="na">size</span> <span class="na">size</span>
</pre></div>
</div>
<p>If a screen has no parameters, it still should be given empty
parentheses. If any other screen <code class="docutils literal notranslate"><span class="pre">use</span></code>s a screen with no
parentheses, the difference in behavior are described in the section
concerning <a class="reference internal" href="#sl-use"><span class="std std-ref">the use statement</span></a>. If no other screen
<code class="docutils literal notranslate"><span class="pre">use</span></code> a given screen, not giving parentheses to that screen leads to
pure inefficiency in the way Ren'py works internally, see the
<a class="reference internal" href="screen_optimization.html"><span class="doc">screen optimization section</span></a> concerning
parameters.</p>
</div>
</div>
<div class="section" id="user-interface-statements">
<h2>User Interface Statements<a class="headerlink" href="#user-interface-statements" title="Permalink to this headline"> link</a></h2>
<p>The user interface statements create displayables and add them either
to the screen, or to an enclosing displayable. They allow the user to
display information, allow the user to interact with the game, or
allow the game to react to various events.</p>
<p id="common-properties">All user interface statements take the following common properties:</p>
<dl class="docutils">
<dt><cite>at</cite></dt>
<dd><p class="first">This can be a transform, or a list of transforms, or an anonymous
transform (a transform that is defined directly in at)</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">transform</span> <span class="n">hello_t</span><span class="p">:</span>
<span class="na">align</span> <span class="p">(</span><span class="mf">0.7</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span> <span class="na">alpha</span> <span class="mf">0.0</span>
<span class="n">linear</span> <span class="mf">0.5</span> <span class="na">alpha</span> <span class="mf">1.0</span>
<span class="k">screen</span> <span class="n">hello_title</span><span class="p">():</span>
<span class="k">text</span> <span class="s2">&quot;Hello.&quot;</span> <span class="k">at</span> <span class="n">hello_t</span>
<span class="k">text</span> <span class="s2">&quot;Hello.&quot;</span><span class="p">:</span>
<span class="k">at</span> <span class="k">transform</span><span class="p">:</span>
<span class="na">align</span> <span class="p">(</span><span class="mf">0.2</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">)</span> <span class="na">alpha</span> <span class="mf">0.0</span>
<span class="n">linear</span> <span class="mf">0.5</span> <span class="na">alpha</span> <span class="mf">1.0</span>
</pre></div>
</div>
<p>This transforms are used to wrap this displayable. The show, hide,
replace, and replaced external events are delivered to a transform
if and only if it is added directly to the screen.</p>
<p class="last">For example, if a vbox is wrapped in a transform, and added directly
to the screen, then events are delivered to that transform. But if
a transform wraps a textbutton that is added to the vbox, this
second transform is not given events.</p>
</dd>
<dt><cite>default_focus</cite></dt>
<dd><p class="first">If given and true, the displayable is focused by default. When
multiple displayables have this, the values are compared and the
displayable with the greatest default focus becomes the default.</p>
<p class="last">The default focus is only used when the last interaction was not
a mouse click, mouse movement, or touch.</p>
</dd>
<dt><cite>id</cite></dt>
<dd><p class="first">An identifier for the user-interface statement. When a screen is
shown, property values can be supplied for the displayables with a
given identifier. Some screens will require that a displayable
with a given identifier is created.</p>
<p class="last">By default, the <code class="docutils literal notranslate"><span class="pre">id</span></code> is automatically-generated.</p>
</dd>
<dt><cite>style</cite></dt>
<dd>A string giving the name of the style applied to this displayable. The
style gives default values for style properties.</dd>
<dt><cite>style_prefix</cite></dt>
<dd><p class="first" id="style-prefix">Provides a prefix to the style of this displayable and all of its
children, unless those children have a more specific style or
style prefix set.</p>
<p>The style name is created by concatenating a style prefix, underscore,
and a style suffix. The style suffix is either specified using
<cite>style_suffix</cite>, or determined by the displayable.</p>
<p>For example, if a vbox has a style prefix of <code class="docutils literal notranslate"><span class="pre">&quot;pref&quot;</span></code>, the vbox
will be given the style <code class="docutils literal notranslate"><span class="pre">&quot;pref_vbox&quot;</span></code>. Unless a more specific style
or style prefix is set, a button inside the vbox will have the style
<code class="docutils literal notranslate"><span class="pre">&quot;pref_button&quot;</span></code>.</p>
<p class="last">Styles accessed in this way are automatically created, if the style
does not exist. Setting a prefix of <code class="docutils literal notranslate"><span class="pre">None</span></code> removes the prefix from
this displayable and its children.</p>
</dd>
<dt><cite>style_group</cite></dt>
<dd>An alias for <cite>style_prefix</cite>, used in older versions of Ren'Py.</dd>
<dt><cite>style_suffix</cite></dt>
<dd><p class="first">Specifies the suffix that is combined with the <cite>style_prefix</cite> to
generate a style name. If this is <code class="docutils literal notranslate"><span class="pre">&quot;small_button&quot;</span></code> and the
style prefix is <code class="docutils literal notranslate"><span class="pre">&quot;pref&quot;</span></code>, the style <code class="docutils literal notranslate"><span class="pre">&quot;pref_small_button&quot;</span></code> is
used.</p>
<p class="last">If no style prefix is in use, this is used directly as the name of
the style. A style suffix applies to a single displayable only, not
a displayable and all children.</p>
</dd>
<dt><cite>focus</cite></dt>
<dd>Takes a string or integer, and gives a name to the displayable
for focus purposes. Ren'Py looks for structural similarity between
focus names when deciding with displayable to give focus to at the
start of an interaction. If a box is given a focus name, and the
third button in that box is focused at the end of an interaction,
the third button of a box with the same will be highlighted at
the start of the next interaction.</dd>
<dt><cite>tooltip</cite></dt>
<dd><p class="first">Assigns a tooltip to this displayable. When the displayable gains
focus, the value of this property will be made available from the
<a class="reference internal" href="screen_actions.html#GetTooltip" title="GetTooltip"><code class="xref py py-func docutils literal notranslate"><span class="pre">GetTooltip()</span></code></a> function. See the <a class="reference internal" href="screen_actions.html#tooltips"><span class="std std-ref">Tooltips</span></a> section for
more details.</p>
<p class="last">Objects passed to tooltip must support equality. If equality is
not supported, an infinite loop may occur.</p>
</dd>
<dt><cite>arguments</cite></dt>
<dd>A tuple or list containing additional positional arguments that
are given to the displayable.</dd>
<dt><cite>properties</cite></dt>
<dd>A dictionary containing additional properties given to the
displayable.</dd>
</dl>
<p>Many user interface statements take classes of style properties, or
transform properties. These properties can have a style prefix
associated with them, that determines when they apply. For example, if
text is given the <code class="docutils literal notranslate"><span class="pre">hover_size</span></code> property, it sets the text size when the
text is hovered.</p>
<p>User interface statements take an <code class="docutils literal notranslate"><span class="pre">as</span></code> clause, which takes a variable
name, without any quotes. The displayable that the statement creates is
assigned to the variable. (An example can be found in <a class="reference internal" href="drag_drop.html#as-example"><span class="std std-ref">the drag and drop
documentation</span></a>.)</p>
<div class="section" id="bar">
<span id="sl-bar"></span><h3>Bar<a class="headerlink" href="#bar" title="Permalink to this headline"> link</a></h3>
<p>Creates a horizontally-oriented bar that can be used to view or adjust
data. It takes the following properties:</p>
<dl class="docutils">
<dt><cite>value</cite></dt>
<dd>The current value of the bar. This can be either a <a class="reference internal" href="screen_actions.html#bar-values"><span class="std std-ref">bar value</span></a>
object, or a number.</dd>
<dt><cite>range</cite></dt>
<dd>The maximum value of the bar. This is required if <cite>value</cite> is a
number.</dd>
<dt><cite>adjustment</cite></dt>
<dd>A <a class="reference internal" href="screen_python.html#ui.adjustment" title="ui.adjustment"><code class="xref py py-func docutils literal notranslate"><span class="pre">ui.adjustment()</span></code></a> object that this bar adjusts.</dd>
<dt><cite>changed</cite></dt>
<dd>If given, this should be a Python function. The function is called
with the value of the adjustment when the adjustment is changed.</dd>
<dt><cite>hovered</cite></dt>
<dd>An action to run when the bar gains focus.</dd>
<dt><cite>unhovered</cite></dt>
<dd>An action to run when the bar loses focus.</dd>
<dt><cite>released</cite></dt>
<dd>An action to run when the bar button is released. This will be invoked
even if the bar has not changed its value.</dd>
</dl>
<p>One of <cite>value</cite> or <cite>adjustment</cite> must be given. In addition, this
function takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#bar-style-properties"><span class="std std-ref">Bar Style Properties</span></a></li>
</ul>
<p>This does not take children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">volume_controls</span><span class="p">():</span>
<span class="k">frame</span><span class="p">:</span>
<span class="k">has</span> <span class="k">vbox</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;sound volume&quot;</span><span class="p">)</span> <span class="na">released</span> <span class="n">Play</span><span class="p">(</span><span class="s2">&quot;sound&quot;</span><span class="p">,</span> <span class="s2">&quot;audio/sample_sound.ogg&quot;</span><span class="p">)</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;music volume&quot;</span><span class="p">)</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;voice volume&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="button">
<span id="sl-button"></span><h3>Button<a class="headerlink" href="#button" title="Permalink to this headline"> link</a></h3>
<p>Creates an area of the screen that can be activated to run an
action. A button takes no parameters, and the following properties.</p>
<dl class="docutils">
<dt><cite>action</cite></dt>
<dd>The action to run when the button is activated. A button is activated
when it is clicked, or when the player selects it and hits enter on the
keyboard. This also controls if the button is sensitive if <cite>sensitive</cite>
is not provided, and if the button is selected if <cite>selected</cite> is not
provided.</dd>
<dt><cite>alternate</cite></dt>
<dd>An action that is run if the button is activated in an alternate manner.
Alternate activation occurs when the player right-clicks on the button
on a mouse-based platform, or when the player long presses the button
on a touch-based platform.</dd>
<dt><cite>hovered</cite></dt>
<dd>An action to run when the button gains focus.</dd>
<dt><cite>unhovered</cite></dt>
<dd>An action to run when the button loses focus.</dd>
<dt><cite>selected</cite></dt>
<dd>An expression that determines whether the button is selected or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine selectedness.</dd>
<dt><cite>sensitive</cite></dt>
<dd>An expression that determines whether the button is sensitive or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine sensitivity.</dd>
<dt><cite>keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the action of this button.</dd>
<dt><cite>alternate_keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the alternate action of this button.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#window-style-properties"><span class="std std-ref">Window Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#button-style-properties"><span class="std std-ref">Button Style Properties</span></a></li>
</ul>
<p>It takes one children. If zero, two, or more children are supplied,
they are implicitly added to a fixed, which is added to the button.</p>
</div>
<div class="section" id="dismiss">
<span id="sl-dismiss"></span><h3>Dismiss<a class="headerlink" href="#dismiss" title="Permalink to this headline"> link</a></h3>
<p>The dismiss statement creates the highly specialized dismiss displayable,
which gains focus when no other displayable has focus,
and runs an action when it's activated. In this regard, it works
very similarly to the behavior of the say statement.</p>
<p>This is rarely used, and mostly to allow a modal frame to be
dismissed when the player clicks outside it, as might be the case
with a popup window.</p>
<p>This takes the following properties:</p>
<dl class="docutils">
<dt><cite>action</cite></dt>
<dd>The action performed when the dismiss is activated. This property is
required.</dd>
<dt><cite>modal</cite></dt>
<dd>By default, the dimiss is modal, preventing events from being processed
by displayables &quot;behind&quot; it.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li>The <a class="reference internal" href="style_properties.html#style-property-hover_sound"><code class="xref std std-propref docutils literal notranslate"><span class="pre">hover_sound</span></code></a> and <a class="reference internal" href="style_properties.html#style-property-activate_sound"><code class="xref std std-propref docutils literal notranslate"><span class="pre">activate_sound</span></code></a> style properties.</li>
</ul>
<p>Here's an example of dismiss being used:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">dismiss_test</span><span class="p">():</span>
<span class="k">dismiss</span> <span class="na">action</span> <span class="n">Return</span><span class="p">()</span>
<span class="k">frame</span><span class="p">:</span>
<span class="na">modal</span> <span class="kc">True</span>
<span class="na">align</span> <span class="p">(</span><span class="o">.</span><span class="mi">5</span><span class="p">,</span> <span class="o">.</span><span class="mi">3</span><span class="p">)</span>
<span class="na">padding</span> <span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="k">has</span> <span class="k">vbox</span>
<span class="k">text</span> <span class="s2">&quot;This is a very important message.&quot;</span><span class="p">:</span>
<span class="na">xalign</span> <span class="mf">0.5</span>
<span class="na">text_align</span> <span class="mf">0.5</span>
<span class="c1"># Dismiss can be confusing on its own, so we&#39;ll add a button as well.</span>
<span class="k">textbutton</span> <span class="s2">&quot;Dismiss&quot;</span><span class="p">:</span>
<span class="na">xalign</span> <span class="mf">0.5</span>
<span class="na">action</span> <span class="n">Return</span><span class="p">()</span>
</pre></div>
</div>
<p>See also how dismiss is used in conjuction with <a class="reference internal" href="#sl-nearrect"><span class="std std-ref">nearrect</span></a>.</p>
</div>
<div class="section" id="fixed">
<span id="sl-fixed"></span><h3>Fixed<a class="headerlink" href="#fixed" title="Permalink to this headline"> link</a></h3>
<p>This creates an area to which children can be added. By default, the
fixed expands to fill the available area, but the <a class="reference internal" href="style_properties.html#style-property-xmaximum"><code class="xref std std-propref docutils literal notranslate"><span class="pre">xmaximum</span></code></a>
and <a class="reference internal" href="style_properties.html#style-property-ymaximum"><code class="xref std std-propref docutils literal notranslate"><span class="pre">ymaximum</span></code></a> properties can change this.</p>
<p>The children are laid out according to their position style
properties. They can overlap if not positioned properly.</p>
<p>The fixed statement takes no parameters, and the following groups of
properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#fixed-style-properties"><span class="std std-ref">Fixed Style Properties</span></a></li>
</ul>
<p>This takes any number of children, which are added to the fixed.</p>
<p>It's often unnecessary to explicitly create a fixed displayable. Each
screen is contained within a fixed displayable, and many screen
language statements automatically create a fixed displayable if they
have two or more children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">ask_are_you_sure</span><span class="p">:</span>
<span class="k">fixed</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Are you sure?&quot;</span> <span class="na">xalign</span> <span class="mf">0.5</span> <span class="na">yalign</span> <span class="mf">0.3</span>
<span class="k">textbutton</span> <span class="s2">&quot;Yes&quot;</span> <span class="na">xalign</span> <span class="mf">0.33</span> <span class="na">yalign</span> <span class="mf">0.5</span> <span class="na">action</span> <span class="n">Return</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;No&quot;</span> <span class="na">xalign</span> <span class="mf">0.66</span> <span class="na">yalign</span> <span class="mf">0.5</span> <span class="na">action</span> <span class="n">Return</span><span class="p">(</span><span class="kc">False</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="frame">
<span id="sl-frame"></span><h3>Frame<a class="headerlink" href="#frame" title="Permalink to this headline"> link</a></h3>
<p>A frame is a window that contains a background that is intended for
displaying user-interface elements like buttons, bars, and text. It
takes the following groups of properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#window-style-properties"><span class="std std-ref">Window Style Properties</span></a></li>
</ul>
<p>It takes one child. If zero, two, or more children are supplied, then
a fixed is created to contain them.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">test_frame</span><span class="p">():</span>
<span class="k">frame</span><span class="p">:</span>
<span class="na">xpadding</span> <span class="mi">10</span>
<span class="na">ypadding</span> <span class="mi">10</span>
<span class="na">xalign</span> <span class="mf">0.5</span>
<span class="na">yalign</span> <span class="mf">0.5</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Display&quot;</span>
<span class="k">null</span> <span class="na">height</span> <span class="mi">10</span>
<span class="k">textbutton</span> <span class="s2">&quot;Fullscreen&quot;</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;fullscreen&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Window&quot;</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;window&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="grid">
<span id="sl-grid"></span><h3>Grid<a class="headerlink" href="#grid" title="Permalink to this headline"> link</a></h3>
<p>This displays its children in a grid. Each child is given an area of
the same size, the size of the largest child.</p>
<p>It takes two parameters. The first is the number of columns in the
grid, and the second is the number of rows in the grid. It takes the
following property:</p>
<dl class="docutils">
<dt><cite>transpose</cite></dt>
<dd>If False (the default), rows are filled before columns. If True,
then columns are filled before rows.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#grid-style-properties"><span class="std std-ref">Grid Style Properties</span></a></li>
</ul>
<p>This must be given (columns * rows) children. Giving it a different
number of children is an error.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">grid_test</span><span class="p">:</span>
<span class="k">grid</span> <span class="mi">2</span> <span class="mi">3</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Top-Left&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Top-Right&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Center-Left&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Center-Right&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Bottom-Left&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Bottom-Right&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="hbox">
<span id="sl-hbox"></span><h3>Hbox<a class="headerlink" href="#hbox" title="Permalink to this headline"> link</a></h3>
<p>This displays its children side by side, in an invisible horizontal
box. It takes no parameters, and the following groups of properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#box-style-properties"><span class="std std-ref">Box Style Properties</span></a></li>
</ul>
<p>UI displayable children are added to the box.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">hbox_text</span><span class="p">():</span>
<span class="k">hbox</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Left&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Right&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="imagebutton">
<span id="sl-imagebutton"></span><h3>Imagebutton<a class="headerlink" href="#imagebutton" title="Permalink to this headline"> link</a></h3>
<p>Creates a button consisting of images, that change state when the user
hovers over them. This takes no parameters, and the following
properties:</p>
<dl class="docutils">
<dt><cite>auto</cite></dt>
<dd><p class="first">Used to automatically define the images used by this button. This
should be a string that contains %s in it. If it is, and one of
the image properties is omitted, %s is replaced with the name of
that property, and the value is used as the default for that
property.</p>
<p>For example, if <cite>auto</cite> is &quot;button_%s.png&quot;, and <cite>idle</cite> is omitted, then
idle defaults to &quot;button_idle.png&quot;. Similarly, if <cite>auto</cite> is &quot;button %s&quot;,
the <code class="docutils literal notranslate"><span class="pre">button</span> <span class="pre">idle</span></code> image is used.</p>
<p class="last">The behavior of <cite>auto</cite> can be customized by changing
<a class="reference internal" href="config.html#var-config.imagemap_auto_function"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.imagemap_auto_function</span></code></a>.</p>
</dd>
<dt><cite>insensitive</cite></dt>
<dd>The image used when the button is insensitive.</dd>
<dt><cite>idle</cite></dt>
<dd>The image used when the button is not focused.</dd>
<dt><cite>hover</cite></dt>
<dd>The image used when the button is focused.</dd>
<dt><cite>selected_idle</cite></dt>
<dd>The image used when the button is selected and idle.</dd>
<dt><cite>selected_hover</cite></dt>
<dd>The image used when the button is selected and hovered.</dd>
<dt><cite>action</cite></dt>
<dd>The action to run when the button is activated. This also controls if
the button is sensitive if <cite>sensitive</cite> is not provided, and if the button
is selected if <cite>selected</cite> is not provided.</dd>
<dt><cite>alternate</cite></dt>
<dd>An action that is run if the button is activated in an alternate manner.
Alternate activation occurs when the player right-clicks on the button
on a mouse-based platform, or when the player long presses the button
on a touch-based platform.</dd>
<dt><cite>hovered</cite></dt>
<dd>An action to run when the button gains focus.</dd>
<dt><cite>unhovered</cite></dt>
<dd>An action to run when the button loses focus.</dd>
<dt><cite>selected</cite></dt>
<dd>An expression that determines whether the button is selected or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine selectedness.</dd>
<dt><cite>sensitive</cite></dt>
<dd>An expression that determines whether the button is sensitive or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine sensitivity.</dd>
<dt><cite>keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the action of this button.</dd>
<dt><cite>alternate_keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the alternate action of this button.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#window-style-properties"><span class="std std-ref">Window Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#button-style-properties"><span class="std std-ref">Button Style Properties</span></a></li>
</ul>
<p>This takes no children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">gui_game_menu</span><span class="p">():</span>
<span class="k">vbox</span> <span class="na">xalign</span> <span class="mf">1.0</span> <span class="na">yalign</span> <span class="mf">1.0</span><span class="p">:</span>
<span class="k">imagebutton</span> <span class="k">auto</span> <span class="s2">&quot;save_</span><span class="si">%s</span><span class="s2">.png&quot;</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s1">&#39;save&#39;</span><span class="p">)</span>
<span class="k">imagebutton</span> <span class="k">auto</span> <span class="s2">&quot;prefs_</span><span class="si">%s</span><span class="s2">.png&quot;</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s1">&#39;preferences&#39;</span><span class="p">)</span>
<span class="k">imagebutton</span> <span class="k">auto</span> <span class="s2">&quot;skip_</span><span class="si">%s</span><span class="s2">.png&quot;</span> <span class="na">action</span> <span class="n">Skip</span><span class="p">()</span>
<span class="k">imagebutton</span> <span class="k">auto</span> <span class="s2">&quot;afm_</span><span class="si">%s</span><span class="s2">.png&quot;</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;auto-forward mode&quot;</span><span class="p">,</span> <span class="s2">&quot;toggle&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="input">
<span id="sl-input"></span><h3>Input<a class="headerlink" href="#input" title="Permalink to this headline"> link</a></h3>
<p>Creates a text input area, which allows the user to enter text. When
the user presses return, the text will be returned by the
interaction. (When the screen is invoked through <code class="docutils literal notranslate"><span class="pre">call</span> <span class="pre">screen</span></code>, the result
will be placed in the <code class="docutils literal notranslate"><span class="pre">_return</span></code> variable.)</p>
<p>Due to limitations in supporting libraries, on Android and the web platform
the input displayable is limited to alphabetic characters.</p>
<p>The input statement takes no parameters, and the following properties:</p>
<dl class="docutils">
<dt><cite>value</cite></dt>
<dd><p class="first">An <a class="reference internal" href="screen_actions.html#input-values"><span class="std std-ref">input value</span></a> object that this input uses.
InputValue objects determine where the default value is taken from,
what happens when the text is changed, what happens when enter is
pressed, and if the text is editable by default.</p>
<p class="last">This should not be given at the same time as <cite>default</cite> and <cite>changed</cite>.</p>
</dd>
<dt><cite>default</cite></dt>
<dd>The default text in this input.</dd>
<dt><cite>length</cite></dt>
<dd>The maximum length of the text in this input.</dd>
<dt><cite>pixel_width</cite></dt>
<dd>The maximum pixel width of the input. If typing a character would
cause the input to exceed this width, the keypress is ignored.</dd>
<dt><cite>allow</cite></dt>
<dd>A string containing characters that are allowed to be typed into
this input. (By default, allow all characters.)</dd>
<dt><cite>exclude</cite></dt>
<dd>A string containing characters that are disallowed from being
typed into this input. (By default, &quot;{}&quot;.)</dd>
<dt><cite>copypaste</cite></dt>
<dd>If True, it becomes possible to copy and paste
into this input. (By default, disabled.)</dd>
<dt><cite>prefix</cite></dt>
<dd>An immutable string to prepend to what the user has typed.</dd>
<dt><cite>suffix</cite></dt>
<dd>An immutable string to append to what the user has typed.</dd>
<dt><cite>changed</cite></dt>
<dd>A Python function that is called with what the user has typed,
when the string changes.</dd>
<dt><cite>mask</cite></dt>
<dd>If given, a string that replaces each displayable character in
the text. This can be used to mask out a password.</dd>
<dt><cite>caret_blink</cite></dt>
<dd>If not False, the blinking period of the default caret.
Overrides <a class="reference internal" href="config.html#var-config.input_caret_blink"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.input_caret_blink</span></code></a>.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#text-style-properties"><span class="std std-ref">Text Style Properties</span></a></li>
</ul>
<p>This does not take any children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">input_screen</span><span class="p">():</span>
<span class="k">window</span><span class="p">:</span>
<span class="k">has</span> <span class="k">vbox</span>
<span class="k">text</span> <span class="s2">&quot;Enter your name.&quot;</span>
<span class="nb">input</span> <span class="k">default</span> <span class="s2">&quot;Joseph P. Blow, ESQ.&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="key">
<span id="sl-key"></span><h3>Key<a class="headerlink" href="#key" title="Permalink to this headline"> link</a></h3>
<p>This creates a keybinding that runs an action when a key is pressed,
or one of the keys in a given list. Key is used in a loose sense here,
as it also allows joystick and mouse events.</p>
<p>Key takes one positional parameter, a string giving the key to
bind. See the <a class="reference internal" href="keymap.html"><span class="doc">Customizing the Keymap</span></a> section for a description of available
keysyms. It takes two properties:</p>
<dl class="docutils">
<dt><cite>action</cite></dt>
<dd>This gives an action that is run when the key is pressed. This
property is mandatory.</dd>
<dt><cite>capture</cite></dt>
<dd>If true, the default, the event will capture, and will not be
processed by other displayables. If false and the action does
not end the interaction, the event will be procssed by other
displayables.</dd>
</dl>
<p>It takes no children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">keymap_screen</span><span class="p">():</span>
<span class="k">key</span> <span class="s2">&quot;game_menu&quot;</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s1">&#39;save&#39;</span><span class="p">)</span>
<span class="k">key</span> <span class="s2">&quot;p&quot;</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s1">&#39;preferences&#39;</span><span class="p">)</span>
<span class="k">key</span> <span class="p">[</span><span class="s2">&quot;s&quot;</span><span class="p">,</span> <span class="s2">&quot;w&quot;</span><span class="p">]</span> <span class="na">action</span> <span class="n">Screenshot</span><span class="p">()</span>
</pre></div>
</div>
</div>
<div class="section" id="label">
<span id="sl-label"></span><h3>Label<a class="headerlink" href="#label" title="Permalink to this headline"> link</a></h3>
<p>Creates a window in the label style, and then places text inside that
window. Together, this combination is used to label things inside a
frame.</p>
<p>It takes one positional argument, the text of the label. It takes
the property:</p>
<dl class="docutils">
<dt><cite>text_style</cite></dt>
<dd>The name of the style to use for the button text. If not supplied,
and the <cite>style</cite> property is a string, then <code class="docutils literal notranslate"><span class="pre">&quot;_text&quot;</span></code> is appended
to that string to give the default text style.</dd>
<dt><cite>text_</cite>-</dt>
<dd>Other properties prefixed with <a class="reference internal" href="#text">text</a> have this prefix stripped, and
are then passed to the text displayable.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#window-style-properties"><span class="std std-ref">Window Style Properties</span></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">display_preference</span><span class="p">():</span>
<span class="k">frame</span><span class="p">:</span>
<span class="k">has</span> <span class="k">vbox</span>
<span class="k">label</span> <span class="s2">&quot;Display&quot;</span>
<span class="k">textbutton</span> <span class="s2">&quot;Fullscreen&quot;</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;fullscreen&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Window&quot;</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;window&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="sl-mousearea">
<span id="mousearea"></span><span id="id1"></span><h3>Mousearea<a class="headerlink" href="#sl-mousearea" title="Permalink to this headline"> link</a></h3>
<p>A mouse area is an area of the screen that can react to the mouse
entering or leaving it. Unlike a button, a mouse area does not take
focus, so it's possible to have a mouse area with buttons inside it.
The <code class="docutils literal notranslate"><span class="pre">mousearea</span></code> statement takes no parameters, and the following properties:</p>
<dl class="docutils">
<dt><cite>hovered</cite></dt>
<dd>An action to run when the mouse enters the mouse area.</dd>
<dt><cite>unhovered</cite></dt>
<dd>An action to run when the mouse leaves the mouse area.</dd>
<dt><cite>focus_mask</cite></dt>
<dd>The <a class="reference internal" href="style_properties.html#style-property-focus_mask"><code class="xref std std-propref docutils literal notranslate"><span class="pre">focus_mask</span></code></a> style property, which may be a Displayable
or None. If a displayable, the mousearea will only be hovered if the
mouse is over an opaque portion of the displayable. (The displayable
is not shown to the user.)</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
</ul>
<p>It does not take children.</p>
<p>Usually, a mousearea statement is given the <a class="reference internal" href="style_properties.html#style-property-area"><code class="xref std std-propref docutils literal notranslate"><span class="pre">area</span></code></a> style
property, which controls the size and position of the mouse
area. Without some way of controlling its size, the mouse area would
take up the entire screen, a less useful behavior.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Since Ren'Py games can be played using the keyboard and joystick, it
often makes sense to duplicate mousearea functionality by some other
means.</p>
</div>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">button_overlay</span><span class="p">():</span>
<span class="k">mousearea</span><span class="p">:</span>
<span class="na">area</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="na">hovered</span> <span class="n">Show</span><span class="p">(</span><span class="s2">&quot;buttons&quot;</span><span class="p">,</span> <span class="n">transition</span><span class="o">=</span><span class="n">dissolve</span><span class="p">)</span>
<span class="na">unhovered</span> <span class="n">Hide</span><span class="p">(</span><span class="s2">&quot;buttons&quot;</span><span class="p">,</span> <span class="n">transition</span><span class="o">=</span><span class="n">dissolve</span><span class="p">)</span>
<span class="k">screen</span> <span class="n">buttons</span><span class="p">():</span>
<span class="k">hbox</span><span class="p">:</span>
<span class="k">textbutton</span> <span class="s2">&quot;Save&quot;</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s2">&quot;save&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Prefs&quot;</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s2">&quot;preferences&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Skip&quot;</span> <span class="na">action</span> <span class="n">Skip</span><span class="p">()</span>
<span class="k">textbutton</span> <span class="s2">&quot;Auto&quot;</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;auto-forward&quot;</span><span class="p">,</span> <span class="s2">&quot;toggle&quot;</span><span class="p">)</span>
<span class="k">label</span> <span class="n">start</span><span class="p">:</span>
<span class="k">show</span> <span class="k">screen</span> <span class="n">button_overlay</span>
</pre></div>
</div>
</div>
<div class="section" id="nearrect">
<span id="sl-nearrect"></span><h3>Nearrect<a class="headerlink" href="#nearrect" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">nearrect</span></code> statement takes a single child, and lays that child out
at a location near a rectangle. Usually, this is a rectangle focus captured using
the <a class="reference internal" href="screen_actions.html#CaptureFocus" title="CaptureFocus"><code class="xref py py-func docutils literal notranslate"><span class="pre">CaptureFocus()</span></code></a> action. This can be used for tooltips and dropdown or
pulldown menus.</p>
<p>Nearrect takes the following properties:</p>
<dl class="docutils">
<dt><cite>rect</cite></dt>
<dd>If given, this should be an (x, y, w, h) rectangle that the child is
positioned relative to, as described below.</dd>
<dt><cite>focus</cite></dt>
<dd><p class="first">If given, this should be a string. This string is passed to the equivalent of
<a class="reference internal" href="screen_actions.html#GetFocusRect" title="GetFocusRect"><code class="xref py py-func docutils literal notranslate"><span class="pre">GetFocusRect()</span></code></a> to find the rectangle. If a focus rectangle with that
name is found, the child is rendered.</p>
<p class="last">Passing &quot;tooltip&quot; to this uses the location of the last displayable that
was focused while displaying a tooltip.</p>
</dd>
<dt><cite>prefer_top</cite></dt>
<dd>If given, positioning the child above the focus rect is preferred.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
</ul>
<p>Nearrect differs from the other layouts in that it positions its child near
the given rectangle, rather than inside it. The child is first rendered with
the full width available, and the maximum of the height above and height below
the rectangle. The y position is then computed as followed.</p>
<ul class="simple">
<li>If the child will fit above the rectangle and <cite>prefer_top</cite> is given, the child
is positioned directly above the rectangle.</li>
<li>Otherwise, if the child can fit below the rectangle, it's positioned directly
below the rectangle.</li>
<li>Otherwise, the child is positioned directly above the rectangle.</li>
</ul>
<p>The x positioning is computed using the normal rules, using the <a class="reference internal" href="style_properties.html#style-property-xpos"><code class="xref std std-propref docutils literal notranslate"><span class="pre">xpos</span></code></a>
and <a class="reference internal" href="style_properties.html#style-property-xanchor"><code class="xref std std-propref docutils literal notranslate"><span class="pre">xanchor</span></code></a> properties of the child, and properties that set them,
such as <a class="reference internal" href="style_properties.html#style-property-xalign"><code class="xref std std-propref docutils literal notranslate"><span class="pre">xalign</span></code></a>. The pos properties are relative to the x coordinate
of the rectangle, and in the case of a floating point number, the width.</p>
<p>At the end of positioning, the <a class="reference internal" href="style_properties.html#style-property-xoffset"><code class="xref std std-propref docutils literal notranslate"><span class="pre">xoffset</span></code></a> and <a class="reference internal" href="style_properties.html#style-property-yoffset"><code class="xref std std-propref docutils literal notranslate"><span class="pre">yoffset</span></code></a>
properties are applied as normal.</p>
<p>If the child of the nearrect is a transform, the transform is given <code class="docutils literal notranslate"><span class="pre">show</span></code>
and <code class="docutils literal notranslate"><span class="pre">hide</span></code> events. However, the position will change instantly. Nearrect
works best on the top of a screen, with transforms and positioning applied
to its child, rather the nearrect.</p>
<p>One use of nearrect is for dropdown menus:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">default</span> <span class="n">difficulty</span> <span class="o">=</span> <span class="s2">&quot;Easy&quot;</span>
<span class="k">screen</span> <span class="n">select_difficulty</span><span class="p">():</span>
<span class="c1"># This frame can be a very complex layout, if required.</span>
<span class="k">frame</span><span class="p">:</span>
<span class="na">align</span> <span class="p">(</span><span class="o">.</span><span class="mi">5</span><span class="p">,</span> <span class="o">.</span><span class="mi">3</span><span class="p">)</span>
<span class="na">padding</span> <span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span>
<span class="k">has</span> <span class="k">vbox</span>
<span class="c1"># This is the button that is clicked to enable the dropdown,</span>
<span class="k">textbutton</span> <span class="s2">&quot;Difficulty: [difficulty]&quot;</span><span class="p">:</span>
<span class="c1"># This action captures the focus rectangle, and in doing so,</span>
<span class="c1"># displays the dropdown.</span>
<span class="na">action</span> <span class="n">CaptureFocus</span><span class="p">(</span><span class="s2">&quot;diff_drop&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Done&quot;</span><span class="p">:</span>
<span class="na">action</span> <span class="n">Return</span><span class="p">()</span>
<span class="c1"># All sorts of other screen elements could be here, but the nearrect needs</span>
<span class="c1"># be at the top level, and the last thing show, apart from its child.</span>
<span class="c1"># Only if the focus has been captured, display the dropdown.</span>
<span class="c1"># You could also use showif instead of basic if</span>
<span class="k">if</span> <span class="n">GetFocusRect</span><span class="p">(</span><span class="s2">&quot;diff_drop&quot;</span><span class="p">):</span>
<span class="c1"># If the player clicks outside the frame, dismiss the dropdown.</span>
<span class="c1"># The ClearFocus action dismisses this dropdown.</span>
<span class="k">dismiss</span> <span class="na">action</span> <span class="n">ClearFocus</span><span class="p">(</span><span class="s2">&quot;diff_drop&quot;</span><span class="p">)</span>
<span class="c1"># This positions the displayable near (usually under) the button above.</span>
<span class="k">nearrect</span><span class="p">:</span>
<span class="na">focus</span> <span class="s2">&quot;diff_drop&quot;</span>
<span class="c1"># Finally, this frame contains the choices in the dropdown, with</span>
<span class="c1"># each using ClearFocus to dismiss the dropdown.</span>
<span class="k">frame</span><span class="p">:</span>
<span class="na">modal</span> <span class="kc">True</span>
<span class="k">has</span> <span class="k">vbox</span>
<span class="k">textbutton</span> <span class="s2">&quot;Easy&quot;</span> <span class="na">action</span> <span class="p">[</span> <span class="n">SetVariable</span><span class="p">(</span><span class="s2">&quot;difficulty&quot;</span><span class="p">,</span> <span class="s2">&quot;Easy&quot;</span><span class="p">),</span> <span class="n">ClearFocus</span><span class="p">(</span><span class="s2">&quot;diff_drop&quot;</span><span class="p">)</span> <span class="p">]</span>
<span class="k">textbutton</span> <span class="s2">&quot;Medium&quot;</span> <span class="na">action</span> <span class="p">[</span> <span class="n">SetVariable</span><span class="p">(</span><span class="s2">&quot;difficulty&quot;</span><span class="p">,</span> <span class="s2">&quot;Medium&quot;</span><span class="p">),</span> <span class="n">ClearFocus</span><span class="p">(</span><span class="s2">&quot;diff_drop&quot;</span><span class="p">)</span> <span class="p">]</span>
<span class="k">textbutton</span> <span class="s2">&quot;Hard&quot;</span> <span class="na">action</span> <span class="p">[</span> <span class="n">SetVariable</span><span class="p">(</span><span class="s2">&quot;difficulty&quot;</span><span class="p">,</span> <span class="s2">&quot;Hard&quot;</span><span class="p">),</span> <span class="n">ClearFocus</span><span class="p">(</span><span class="s2">&quot;diff_drop&quot;</span><span class="p">)</span> <span class="p">]</span>
<span class="k">textbutton</span> <span class="s2">&quot;Nightmare&quot;</span> <span class="na">action</span> <span class="p">[</span> <span class="n">SetVariable</span><span class="p">(</span><span class="s2">&quot;difficulty&quot;</span><span class="p">,</span> <span class="s2">&quot;Nightmare&quot;</span><span class="p">),</span> <span class="n">ClearFocus</span><span class="p">(</span><span class="s2">&quot;diff_drop&quot;</span><span class="p">)</span> <span class="p">]</span>
</pre></div>
</div>
<p>Dropdowns may benefit from improved styling, which isn't done here.</p>
</div>
<div class="section" id="null">
<span id="sl-null"></span><h3>Null<a class="headerlink" href="#null" title="Permalink to this headline"> link</a></h3>
<p>The null statement inserts an empty area on the screen. This can be
used to space things out. The null statement takes no parameters, and
the following properties:</p>
<dl class="docutils">
<dt><cite>width</cite></dt>
<dd>The width of the empty area, in pixels.</dd>
<dt><cite>height</cite></dt>
<dd>The height of the empty area, in pixels.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">text_box</span><span class="p">():</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;The title.&quot;</span>
<span class="k">null</span> <span class="na">height</span> <span class="mi">20</span>
<span class="k">text</span> <span class="s2">&quot;This body text.&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="side">
<span id="sl-side"></span><h3>Side<a class="headerlink" href="#side" title="Permalink to this headline"> link</a></h3>
<p>This positions displayables in the corners or center of a grid. It
takes a single parameter, string containing a space-separated list of
places to place its children. Each component of this list should be
one of:</p>
<blockquote>
<div>'c', 't', 'b', 'l', 'r', 'tl', 'tr', 'bl', 'br'</div></blockquote>
<p>'c' means center, 't' top, 'tl' top left, 'br' bottom right, and so on.</p>
<p>A side takes the following properties:</p>
<dl class="docutils">
<dt><cite>spacing</cite></dt>
<dd>The spacing between the rows and columns of the grid.</dd>
</dl>
<p>A side takes the following property groups:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
</ul>
<p>When being rendered, this first sizes the corners, then the sides,
then the center. The corners and sides are rendered with an available
area of 0, so it may be necessary to supply them a minimum size (using
<a class="reference internal" href="style_properties.html#style-property-xminimum"><code class="xref std std-propref docutils literal notranslate"><span class="pre">xminimum</span></code></a> or <a class="reference internal" href="style_properties.html#style-property-yminimum"><code class="xref std std-propref docutils literal notranslate"><span class="pre">yminimum</span></code></a>) to ensure they render at
all.
The order of placing children is controlled from top to bottom when
adding them (i.e. also in the order of substrings in the argument),
the latter will be the highest. This is may be disabled by
<a class="reference internal" href="config.html#var-config.keep_side_render_order"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.keep_side_render_order</span></code></a>.</p>
<p>Children correspond to entries in the places list, so this must have
the same number of children as there are entries in the places list.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">side_test</span><span class="p">():</span>
<span class="k">side</span> <span class="s2">&quot;c tl br&quot;</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Center&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Top-Left&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Bottom-Right&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="text">
<span id="sl-text"></span><h3>Text<a class="headerlink" href="#text" title="Permalink to this headline"> link</a></h3>
<p>The text statement displays text. It takes a single parameter, the
text to display. It also takes the following groups of properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#text-style-properties"><span class="std std-ref">Text Style Properties</span></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">hello_world</span><span class="p">():</span>
<span class="k">text</span> <span class="s2">&quot;Hello, World.&quot;</span> <span class="na">size</span> <span class="mi">40</span>
</pre></div>
</div>
</div>
<div class="section" id="textbutton">
<span id="sl-textbutton"></span><h3>Textbutton<a class="headerlink" href="#textbutton" title="Permalink to this headline"> link</a></h3>
<p>Creates a button containing a text label. The button takes a single
parameter, the text to include as part of the button. It takes the
following properties:</p>
<dl class="docutils">
<dt><cite>action</cite></dt>
<dd>The action to run when the button is activated. This also controls if
the button is sensitive if <cite>sensitive</cite> is not provided, and if the button
is selected if <cite>selected</cite> is not provided.</dd>
<dt><cite>alternate</cite></dt>
<dd>An action that is run if the button is activated in an alternate manner.
Alternate activation occurs when the player right-clicks on the button
on a mouse-based platform, or when the player long presses the button
on a touch-based platform.</dd>
<dt><cite>hovered</cite></dt>
<dd>An action to run when the button gains focus.</dd>
<dt><cite>unhovered</cite></dt>
<dd>An action to run when the button loses focus.</dd>
<dt><cite>selected</cite></dt>
<dd>An expression that determines whether the button is selected or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine selectedness.</dd>
<dt><cite>sensitive</cite></dt>
<dd>An expression that determines whether the button is sensitive or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine sensitivity.</dd>
<dt><cite>keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the action of this button.</dd>
<dt><cite>alternate_keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the alternate action of this button.</dd>
<dt><cite>text_style</cite></dt>
<dd>The name of the style to use for the button text. If not supplied,
and the <cite>style</cite> property is a string, then <code class="docutils literal notranslate"><span class="pre">&quot;_text&quot;</span></code> is appended
to that string to give the default text style.</dd>
<dt><cite>text_</cite>-</dt>
<dd>Other properties prefixed with <a class="reference internal" href="#text">text</a> have this prefix stripped, and are
then passed to the text displayable.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#window-style-properties"><span class="std std-ref">Window Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#button-style-properties"><span class="std std-ref">Button Style Properties</span></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">textbutton_screen</span><span class="p">():</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">textbutton</span> <span class="s2">&quot;Wine&quot;</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s2">&quot;wine&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Women&quot;</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s2">&quot;women&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Song&quot;</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s2">&quot;song&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="timer">
<span id="sl-timer"></span><h3>Timer<a class="headerlink" href="#timer" title="Permalink to this headline"> link</a></h3>
<p>This creates a timer that runs an action when time runs out. It takes
one positional parameter, giving the timeout time, in seconds. It
takes the properties:</p>
<dl class="docutils">
<dt><cite>action</cite></dt>
<dd>This gives an action that is run when the timer expires. This
property is mandatory.</dd>
<dt><cite>repeat</cite></dt>
<dd>If True, the timer repeats after it times out.</dd>
<dt><cite>modal</cite></dt>
<dd>If True, the timer will not fire if it is blocked by a modal
screen. If false or not given, the timer will fire even if it
is blocked by a modal screen.</dd>
</dl>
<p>Timer takes no children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">timer_test</span><span class="p">():</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">textbutton</span> <span class="s2">&quot;Yes.&quot;</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s2">&quot;yes&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;No.&quot;</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s2">&quot;no&quot;</span><span class="p">)</span>
<span class="k">timer</span> <span class="mf">3.0</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s2">&quot;too_slow&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="transform">
<span id="sl-transform"></span><h3>Transform<a class="headerlink" href="#transform" title="Permalink to this headline"> link</a></h3>
<p>Applies a transform to its child. This takes no parameters, and the
following property groups:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="atl.html#transform-properties"><span class="std std-ref">Transform Properties</span></a></li>
</ul>
<p>This should take a single child.</p>
</div>
<div class="section" id="vbar">
<span id="sl-vbar"></span><h3>Vbar<a class="headerlink" href="#vbar" title="Permalink to this headline"> link</a></h3>
<p>The vertically oriented equivalent of <a class="reference internal" href="#bar">bar</a>. Properties are the same
as <cite>bar</cite>.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">volume_controls</span><span class="p">():</span>
<span class="k">frame</span><span class="p">:</span>
<span class="k">has</span> <span class="k">hbox</span>
<span class="k">vbar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;sound volume&quot;</span><span class="p">)</span>
<span class="k">vbar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;music volume&quot;</span><span class="p">)</span>
<span class="k">vbar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;voice volume&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="vbox">
<span id="sl-vbox"></span><h3>Vbox<a class="headerlink" href="#vbox" title="Permalink to this headline"> link</a></h3>
<p>This displays its children one above the other, in an invisible
vertical box. It takes no parameters, and the following groups of
properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#box-style-properties"><span class="std std-ref">Box Style Properties</span></a></li>
</ul>
<p>UI displayable children are added to the box.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">vbox_test</span><span class="p">():</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Top.&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Bottom.&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="viewport">
<span id="sl-viewport"></span><h3>Viewport<a class="headerlink" href="#viewport" title="Permalink to this headline"> link</a></h3>
<p>A viewport is area of the screen that can be scrolled by dragging,
with the mouse wheel, or with scrollbars. It can be used to display
part of something that is bigger than the screen. It takes the
following properties:</p>
<dl class="docutils">
<dt><cite>child_size</cite></dt>
<dd>The size that is offered to the child for rendering. An (<cite>xsize</cite>,
<cite>ysize</cite>) tuple. This can usually be omitted, when the child can
compute it's own size. If either component is None, the child's
size is used.</dd>
<dt><cite>mousewheel</cite></dt>
<dd><p class="first">This should be one of:</p>
<dl class="last docutils">
<dt>False</dt>
<dd>To ignore the mousewheel. (The default.)</dd>
<dt>True</dt>
<dd>To scroll vertically.</dd>
<dt>&quot;horizontal&quot;</dt>
<dd>To scroll horizontally.</dd>
<dt>&quot;change&quot;</dt>
<dd>To scroll the viewport vertically, only if doing so would cause the
viewport to move. If not, the mousewheel event is passed to the rest
of the interface. (For example, if change is given, placing
<code class="docutils literal notranslate"><span class="pre">key</span> <span class="pre">&quot;viewport_wheeldown&quot;</span> <span class="pre">action</span> <span class="pre">Return()</span></code> before the viewport
will cause the screen to return if the viewport scrolls past the
bottom.)</dd>
<dt>&quot;horizontal-change&quot;</dt>
<dd>Combines horizontal scrolling with change mode.</dd>
</dl>
</dd>
<dt><cite>draggable</cite></dt>
<dd>If True, dragging the mouse will scroll the viewport.</dd>
<dt><cite>edgescroll</cite></dt>
<dd><p class="first">Controlls scrolling when the mouse reaches the edge of the
viewport. If not None, this should be a two- or three-element
tuple:</p>
<ul class="last simple">
<li>The first element in the tuple is the distance from
the edge of the viewport that edgescrolling begins to take
effect, in pixels.</li>
<li>The second element is the maximum scrolling rate, in pixels per
second.</li>
<li>If present, the third element is a function that adjusts the
scrolling speed, based on how close to the pointer is to an
edge. The function should take a number between -1.0 and 1.0, and
return a number in the same range. The default function returns
its input, and implements proportional scrolling. A function
that returned -1.0 or 1.0 based on the sign of its input would
implement constant-speed scrolling.</li>
</ul>
</dd>
<dt><cite>xadjustment</cite></dt>
<dd>The <a class="reference internal" href="screen_python.html#ui.adjustment" title="ui.adjustment"><code class="xref py py-func docutils literal notranslate"><span class="pre">ui.adjustment()</span></code></a> used for the x-axis of the
viewport. When omitted, a new adjustment is created.</dd>
<dt><cite>yadjustment</cite></dt>
<dd>The <a class="reference internal" href="screen_python.html#ui.adjustment" title="ui.adjustment"><code class="xref py py-func docutils literal notranslate"><span class="pre">ui.adjustment()</span></code></a> used for the y-axis of the
viewport. When omitted, a new adjustment is created.</dd>
<dt><cite>xinitial</cite></dt>
<dd>The initial horizontal offset of the viewport. This may be an integer
giving the number of pixels, or a float giving a fraction of the
possible offset.</dd>
<dt><cite>yinitial</cite></dt>
<dd>The initial vertical offset of the viewport. This may be an integer
giving the number of pixels, or a float giving a fraction of the
possible offset.</dd>
<dt><cite>scrollbars</cite></dt>
<dd><p class="first">If not None, scrollbars are added along with this viewport.
This works by creating a side layout, and placing the created
viewport in the center of the side. If <cite>scrollbars</cite> is &quot;horizontal&quot;,
a horizontal scrollbar is placed beneath the viewport. If <cite>scrollbars</cite>
is &quot;vertical&quot;, a vertical scrollbar is placed to the right of the
viewport. If <cite>scrollbars</cite> is &quot;both&quot;, both horizontal and vertical
scrollbars are created.</p>
<p>When <cite>scrollbars</cite> is not None, the <cite>viewport</cite> takes prefixed properties:</p>
<ul class="simple">
<li>Properties beginning with <code class="docutils literal notranslate"><span class="pre">viewport_</span></code> are passed to the viewport.</li>
<li>Properties beginning with <code class="docutils literal notranslate"><span class="pre">side_</span></code> are passed to the side.</li>
<li>Properties beginning with <code class="docutils literal notranslate"><span class="pre">scrollbar_</span></code> are passed to the horizontal scrollbar, if it exists.</li>
<li>Properties beginning with <code class="docutils literal notranslate"><span class="pre">vscrollbar_</span></code> are passed to the verical scrollbar, if it exists.</li>
</ul>
<p class="last">Unprefixed properties are also accepted. <a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a> are
passed to the side, while other unprefixed properties are supplied to the
viewport.</p>
</dd>
<dt><cite>arrowkeys</cite></dt>
<dd>If true, the viewport can be scrolled with the left, right, up, and down
arrow keys. This takes precedence over the usual function of these keys,
which is changing focus. However, the arrow keys will change focus when the
viewport reaches its limits.</dd>
<dt><cite>pagekeys</cite></dt>
<dd>If true, the viewport can be scrolled up and down by the pageup and
pagedown keys. This disables the usual functionality of these keys,
which is to cause rollback and rollforward.</dd>
</dl>
<p>In addition, it takes the following groups of style properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
</ul>
<p>It takes one child. If zero, two, or more children are supplied, then
a fixed is created to contain them.</p>
<p>To make a viewport scrollable, it's often best to assign an id to it,
and then use <a class="reference internal" href="screen_actions.html#XScrollValue" title="XScrollValue"><code class="xref py py-func docutils literal notranslate"><span class="pre">XScrollValue()</span></code></a> and <a class="reference internal" href="screen_actions.html#YScrollValue" title="YScrollValue"><code class="xref py py-func docutils literal notranslate"><span class="pre">YScrollValue()</span></code></a> with that
id.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">viewport_example</span><span class="p">():</span>
<span class="k">side</span> <span class="s2">&quot;c b r&quot;</span><span class="p">:</span>
<span class="na">area</span> <span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">600</span><span class="p">,</span> <span class="mi">400</span><span class="p">)</span>
<span class="k">viewport</span> <span class="na">id</span> <span class="s2">&quot;vp&quot;</span><span class="p">:</span>
<span class="na">draggable</span> <span class="kc">True</span>
<span class="k">add</span> <span class="s2">&quot;washington.jpg&quot;</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">XScrollValue</span><span class="p">(</span><span class="s2">&quot;vp&quot;</span><span class="p">)</span>
<span class="k">vbar</span> <span class="na">value</span> <span class="n">YScrollValue</span><span class="p">(</span><span class="s2">&quot;vp&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="vpgrid">
<span id="sl-vpgrid"></span><h3>Vpgrid<a class="headerlink" href="#vpgrid" title="Permalink to this headline"> link</a></h3>
<p>A vpgrid (viewport grid) combines a viewport and grid into a single
displayable. The vpgrid takes multiple children (like a grid) and is
optimized so that only the children being displayed within the viewport
are rendered.</p>
<p>A vpgrid assumes that all children are the same size, the size being taken
from the dimensions of the first child. If a vpgrid appears to be rendering
incorrectly, please ensure that all children are of the same size.</p>
<p>A vpgrid must be given at least one of the <cite>cols</cite> and <cite>rows</cite> properties.
If one is omitted or None, the other is automatically determined from the
size, spacing, and number of children.</p>
<p>Vpgrids take the the following properties:</p>
<dl class="docutils">
<dt><cite>cols</cite></dt>
<dd>The number of columns in the grid.</dd>
<dt><cite>rows</cite></dt>
<dd>The number of rows in the grid.</dd>
<dt><cite>transpose</cite></dt>
<dd>If true, columns are filled before rows. The default of this depends
on the <cite>cols</cite> and <cite>rows</cite> properties. If <cite>cols</cite> is given, columns
are filled before rows, otherwise rows are filled before columns.</dd>
</dl>
<p>In addition, a vpgrid takes all properties a <a class="reference internal" href="#sl-viewport"><span class="std std-ref">viewport</span></a> can,
and the following groups of style properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#grid-style-properties"><span class="std std-ref">Grid Style Properties</span></a></li>
</ul>
<p>When the <cite>scrollbar</cite> property is given, prefixed properties are passed to
the vpgrid in the same way as they are with viewports. (Properties prefixed
with <code class="docutils literal notranslate"><span class="pre">viewport_</span></code> are passed to the vpgrid itself.)</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">vpgrid_test</span><span class="p">():</span>
<span class="k">vpgrid</span><span class="p">:</span>
<span class="na">cols</span> <span class="mi">2</span>
<span class="na">spacing</span> <span class="mi">5</span>
<span class="na">draggable</span> <span class="kc">True</span>
<span class="na">mousewheel</span> <span class="kc">True</span>
<span class="na">scrollbars</span> <span class="s2">&quot;vertical&quot;</span>
<span class="c1"># Since we have scrollbars, this positions the side, rather than</span>
<span class="c1"># the vpgrid.</span>
<span class="na">xalign</span> <span class="mf">0.5</span>
<span class="k">for</span> <span class="n">i</span> <span class="k">in</span> <span class="na">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">101</span><span class="p">):</span>
<span class="k">textbutton</span> <span class="s2">&quot;Button [i]&quot;</span><span class="p">:</span>
<span class="na">xysize</span> <span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">50</span><span class="p">)</span>
<span class="na">action</span> <span class="n">Return</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="window">
<span id="sl-window"></span><h3>Window<a class="headerlink" href="#window" title="Permalink to this headline"> link</a></h3>
<p>A window is a window that contains a background that is intended for
displaying in-game dialogue. It takes the following groups of
properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#window-style-properties"><span class="std std-ref">Window Style Properties</span></a></li>
</ul>
<p>It takes one child. If zero, two, or more children are supplied, then
a fixed is created to contain them.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">say</span><span class="p">(</span><span class="n">who</span><span class="p">,</span> <span class="n">what</span><span class="p">):</span>
<span class="k">window</span> <span class="na">id</span> <span class="s2">&quot;window&quot;</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="na">spacing</span> <span class="mi">10</span>
<span class="k">text</span> <span class="n">who</span> <span class="na">id</span> <span class="s2">&quot;who&quot;</span>
<span class="k">text</span> <span class="n">what</span> <span class="na">id</span> <span class="s2">&quot;what&quot;</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="imagemap-statements">
<h2>Imagemap Statements<a class="headerlink" href="#imagemap-statements" title="Permalink to this headline"> link</a></h2>
<p>A convenient way of creating a screen, especially for those who think
visually, is to create an imagemap. When creating an imagemap, the
imagemap statement is used to specify up to six images. The hotspot
and hotbar images are used to carve rectangular areas out of the
image, and apply actions and values to those areas.</p>
<p>Here's an example of a preferences screen that uses imagemaps.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">preferences</span><span class="p">():</span>
<span class="k">tag</span> <span class="k">menu</span>
<span class="k">use</span> <span class="n">navigation</span>
<span class="k">imagemap</span><span class="p">:</span>
<span class="k">auto</span> <span class="s2">&quot;gui_set/gui_prefs_</span><span class="si">%s</span><span class="s2">.png&quot;</span>
<span class="k">hotspot</span> <span class="p">(</span><span class="mi">740</span><span class="p">,</span> <span class="mi">232</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">73</span><span class="p">)</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;fullscreen&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Display Fullscreen&quot;</span><span class="p">)</span>
<span class="k">hotspot</span> <span class="p">(</span><span class="mi">832</span><span class="p">,</span> <span class="mi">232</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">73</span><span class="p">)</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;window&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Display Window&quot;</span><span class="p">)</span>
<span class="k">hotspot</span> <span class="p">(</span><span class="mi">1074</span><span class="p">,</span> <span class="mi">232</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">73</span><span class="p">)</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;transitions&quot;</span><span class="p">,</span> <span class="s2">&quot;all&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Transitions All&quot;</span><span class="p">)</span>
<span class="k">hotspot</span> <span class="p">(</span><span class="mi">1166</span><span class="p">,</span> <span class="mi">232</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">73</span><span class="p">)</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;transitions&quot;</span><span class="p">,</span> <span class="s2">&quot;none&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Transitions None&quot;</span><span class="p">)</span>
<span class="k">hotbar</span> <span class="p">(</span><span class="mi">736</span><span class="p">,</span> <span class="mi">415</span><span class="p">,</span> <span class="mi">161</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;music volume&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Music Volume&quot;</span><span class="p">)</span>
<span class="k">hotbar</span> <span class="p">(</span><span class="mi">1070</span><span class="p">,</span> <span class="mi">415</span><span class="p">,</span> <span class="mi">161</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;sound volume&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Sound Volume&quot;</span><span class="p">)</span>
<span class="k">hotbar</span> <span class="p">(</span><span class="mi">667</span><span class="p">,</span> <span class="mi">535</span><span class="p">,</span> <span class="mi">161</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;voice volume&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Voice Volume&quot;</span><span class="p">)</span>
<span class="k">hotbar</span> <span class="p">(</span><span class="mi">1001</span><span class="p">,</span> <span class="mi">535</span><span class="p">,</span> <span class="mi">161</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;text speed&quot;</span><span class="p">)</span> <span class="na">alt</span> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;Text Speed&quot;</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="imagemap">
<span id="sl-imagemap"></span><h3>Imagemap<a class="headerlink" href="#imagemap" title="Permalink to this headline"> link</a></h3>
<p>The imagemap statement is used to specify an imagemap. It takes no
parameters, and the following properties:</p>
<dl class="docutils">
<dt><cite>auto</cite></dt>
<dd><p class="first">Used to automatically define the images used by this imagemap. This
should be a string that contains %s in it. If it is, and one of
the image properties is omitted, %s is replaced with the name of
that property, and the value is used as the default for that
property.</p>
<p>For example, if <cite>auto</cite> is &quot;imagemap_%s.png&quot;, and <cite>idle</cite> is omitted, then
idle defaults to &quot;imagemap_idle.png&quot;. If <cite>auto</cite> is &quot;imagemap %s&quot;, the
<code class="docutils literal notranslate"><span class="pre">imagemap</span> <span class="pre">idle</span></code> image is used.</p>
<p class="last">The behavior of <cite>auto</cite> can be customized by changing
<a class="reference internal" href="config.html#var-config.imagemap_auto_function"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.imagemap_auto_function</span></code></a>.</p>
</dd>
<dt><cite>ground</cite></dt>
<dd>The image used for portions of the imagemap that are not part of a
hotspot or hotbar.</dd>
<dt><cite>insensitive</cite></dt>
<dd>The image used when a hotspot or hotbar is insensitive.</dd>
<dt><cite>idle</cite></dt>
<dd>The image used when a hotspot is not selected and not focused, and
for the empty portion of unfocused hotbars.</dd>
<dt><cite>hover</cite></dt>
<dd>The image used when a hotspot is not selected and focused, and
for the empty portion of focused hotbars.</dd>
<dt><cite>selected_idle</cite></dt>
<dd>The image used when a hotspot is selected and not focused, and
for the full portion of unfocused hotbars.</dd>
<dt><cite>selected_hover</cite></dt>
<dd>The image used when a hotspot is selected and focused, and
for the full portion of focused hotbars.</dd>
<dt><cite>alpha</cite></dt>
<dd>If true, the default, a hotspot only gains focus when the mouse is
in an area of the hover image that is opaque. If false, the hotspot
gains focus whenever the mouse is within its rectangular boundary.</dd>
<dt><cite>cache</cite></dt>
<dd>If true, the default, hotspot data is cached in to improve performance
at the cost of some additional disk space.</dd>
</dl>
<p>It takes the following groups of properties:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#position-style-properties"><span class="std std-ref">Position Style Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#fixed-style-properties"><span class="std std-ref">Fixed Style Properties</span></a></li>
</ul>
<p>An imagemap creates a fixed, allowing any child to be added to it (not
just hotspots and hotbars).</p>
</div>
<div class="section" id="hotspot">
<span id="sl-hotspot"></span><h3>Hotspot<a class="headerlink" href="#hotspot" title="Permalink to this headline"> link</a></h3>
<p>A hotspot is a button consisting of a portion of the imagemap that
contains it. It takes a single parameter, a (x, y, width, height)
tuple giving the area of the imagemap that makes up the button. It
also takes the following properties:</p>
<dl class="docutils">
<dt><cite>action</cite></dt>
<dd>The action to run when the button is activated. This also controls
if the button is sensitive, and if the button is selected.</dd>
<dt><cite>alternate</cite></dt>
<dd>An action that is run if the hotspot is activated in an alternate manner.
Alternate activation occurs when the player right-clicks on the hotspot
on a mouse-based platform, or when the player long presses the hotspot
on a touch-based platform.</dd>
<dt><cite>hovered</cite></dt>
<dd>An action to run when the button gains focus.</dd>
<dt><cite>unhovered</cite></dt>
<dd>An action to run when the button loses focus.</dd>
<dt><cite>selected</cite></dt>
<dd>An expression that determines whether the button is selected or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine selectedness.</dd>
<dt><cite>sensitive</cite></dt>
<dd>An expression that determines whether the button is sensitive or not.
This expression is evaluated at least once per interaction.
If not provided, the action will be used to determine sensitivity.</dd>
<dt><cite>keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the action of this button.</dd>
<dt><cite>alternate_keysym</cite></dt>
<dd>A string giving a <a class="reference internal" href="keymap.html"><span class="doc">keysym</span></a> describing a keyboard key that,
when pressed, invokes the alternate action of this button.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#button-style-properties"><span class="std std-ref">Button Style Properties</span></a></li>
</ul>
<p>A hotspot creates a fixed, allowing children to be added to it. The
fixed has an area that is the same size as the hotspot, meaning that
the children will be positioned relative to the hotspot.</p>
<p>Hotspots should be given the <code class="docutils literal notranslate"><span class="pre">alt</span></code> style property to allow Ren'Py's
self-voicing feature to work.</p>
</div>
<div class="section" id="hotbar">
<span id="sl-hotbar"></span><h3>Hotbar<a class="headerlink" href="#hotbar" title="Permalink to this headline"> link</a></h3>
<p>A hotbar is a bar that consists of a portion of the imagemap that
contains it. It takes a single parameter, a (x, y, width, height)
tuple giving the area of the imagemap that makes up the button. It
also takes the following properties:</p>
<dl class="docutils">
<dt><cite>value</cite></dt>
<dd>The current value of the bar. This can be either a <a class="reference internal" href="screen_actions.html#input-values"><span class="std std-ref">bar value</span></a>
object, or a number.</dd>
<dt><cite>range</cite></dt>
<dd>The maximum value of the bar. This is required if <cite>value</cite> is a
number.</dd>
<dt><cite>adjustment</cite></dt>
<dd>A <a class="reference internal" href="screen_python.html#ui.adjustment" title="ui.adjustment"><code class="xref py py-func docutils literal notranslate"><span class="pre">ui.adjustment()</span></code></a> object that this bar adjusts.</dd>
</dl>
<p>One of <cite>value</cite> or <cite>adjustment</cite> must be given. In addition, this
function takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><span class="std std-ref">Common Properties</span></a></li>
<li><a class="reference internal" href="style_properties.html#bar-style-properties"><span class="std std-ref">Bar Style Properties</span></a></li>
</ul>
<p>This does not take children.</p>
<p>Hotbars should be given the <code class="docutils literal notranslate"><span class="pre">alt</span></code> style property to allow Ren'Py's
self-voicing feature to work.</p>
</div>
</div>
<div class="section" id="add-statement">
<h2>Add Statement<a class="headerlink" href="#add-statement" title="Permalink to this headline"> link</a></h2>
<p>The add statement is a bit special, as it adds an already-exising displayble
to the screen. As a result, it doesn't take the properties common to the
user interface statements.</p>
<div class="section" id="add">
<span id="sl-add"></span><h3>Add<a class="headerlink" href="#add" title="Permalink to this headline"> link</a></h3>
<p>Adds an image or other displayable to the screen. This optionally
takes <a class="reference internal" href="atl.html#transform-properties"><span class="std std-ref">transform properties</span></a>. If at least
one transform property is given, a <a class="reference internal" href="trans_trans_python.html#Transform" title="Transform"><code class="xref py py-class docutils literal notranslate"><span class="pre">Transform</span></code></a> is created to wrap the
image, and the properties are given to the transform.</p>
<p>If the displayable is None, nothing is added to the screen.</p>
<p>This does not take any children.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">add_test</span><span class="p">():</span>
<span class="k">add</span> <span class="s2">&quot;logo.png&quot;</span> <span class="na">xalign</span> <span class="mf">1.0</span> <span class="na">yalign</span> <span class="mf">0.0</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="advanced-displayables">
<h2>Advanced Displayables<a class="headerlink" href="#advanced-displayables" title="Permalink to this headline"> link</a></h2>
<p>In addition to the commonly-used statements, the screen language has
statements that correspond to advanced displayables. The mapping from
displayable to statement is simple. Positional parameters of the
displayables become positional parameters of the statement. Keyword
arguments and the relevant style properties become screen language
properties.</p>
<p>The advanced displayable statements are:</p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">drag</span></code></dt>
<dd>Creates a <a class="reference internal" href="drag_drop.html#Drag" title="Drag"><code class="xref py py-class docutils literal notranslate"><span class="pre">Drag</span></code></a>. A drag can be given an optional child,
or the <a class="reference internal" href="style_properties.html#style-property-child"><code class="xref std std-propref docutils literal notranslate"><span class="pre">child</span></code></a> style property can be used to supply the child,
and its focused variants. Drags also take the <a class="reference internal" href="style_properties.html#style-property-focus_mask"><code class="xref std std-propref docutils literal notranslate"><span class="pre">focus_mask</span></code></a>
style property.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">draggroup</span></code></dt>
<dd>Creates a <a class="reference internal" href="drag_drop.html#DragGroup" title="DragGroup"><code class="xref py py-class docutils literal notranslate"><span class="pre">DragGroup</span></code></a>. A drag group may have zero or more
drags as its children.</dd>
</dl>
</div>
<div class="section" id="has-statement">
<span id="sl-has"></span><h2>Has Statement<a class="headerlink" href="#has-statement" title="Permalink to this headline"> link</a></h2>
<p>The has statement allows you to specify a container to use, instead of
fixed, for statements that take only one child. The has statement
may only be used inside a statement that takes one child. The keyword
<code class="docutils literal notranslate"><span class="pre">has</span></code> is followed (on the same line) by another statement, which
must be a statement that creates a container displayable, one that
takes more than one child.</p>
<p>The has statement changes the way in which the block that contains it
is parsed. Child displayables created in that block are added to the
container, rather than the parent displayable. Keyword arguments to
the parent displayable are not allowed after the has
statement. Multiple has statements can be used in the same block.</p>
<p>The has statement can be supplied as a child of the following
statements:</p>
<ul class="simple">
<li>button</li>
<li>frame</li>
<li>window</li>
</ul>
<p>The has statement can be given the following statements as a
container.</p>
<ul class="simple">
<li>fixed</li>
<li>grid</li>
<li>hbox</li>
<li>side</li>
<li>vbox</li>
</ul>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">volume_controls</span><span class="p">():</span>
<span class="k">frame</span><span class="p">:</span>
<span class="k">has</span> <span class="k">vbox</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;sound volume&quot;</span><span class="p">)</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;music volume&quot;</span><span class="p">)</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">Preference</span><span class="p">(</span><span class="s2">&quot;voice volume&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="control-statements">
<h2>Control Statements<a class="headerlink" href="#control-statements" title="Permalink to this headline"> link</a></h2>
<p>The screen language includes control statements for conditional
execution, iteration, including other screens, executing actions when
events occur, and executing arbitrary Python.</p>
<div class="section" id="default">
<span id="sl-default"></span><h3>Default<a class="headerlink" href="#default" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">default</span></code> statement sets the default value of a variable, if it is not
passed as an argument to the screen, or inherited from a screen that calls
us using the use statement.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">scheduler</span><span class="p">():</span>
<span class="k">default</span> <span class="n">club</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;What would you like to do?&quot;</span>
<span class="k">textbutton</span> <span class="s2">&quot;Art Club&quot;</span> <span class="na">action</span> <span class="n">SetScreenVariable</span><span class="p">(</span><span class="s2">&quot;club&quot;</span><span class="p">,</span> <span class="s2">&quot;art&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Writing Club&quot;</span> <span class="na">action</span> <span class="n">SetScreenVariable</span><span class="p">(</span><span class="s2">&quot;club&quot;</span><span class="p">,</span> <span class="s2">&quot;writing&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="n">club</span><span class="p">:</span>
<span class="k">textbutton</span> <span class="s2">&quot;Select&quot;</span> <span class="na">action</span> <span class="n">Return</span><span class="p">(</span><span class="n">club</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="for">
<span id="sl-for"></span><h3>For<a class="headerlink" href="#for" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">for</span></code> statement is similar to the Python <code class="docutils literal notranslate"><span class="pre">for</span></code> statement, except that
it does not support the <code class="docutils literal notranslate"><span class="pre">else</span></code> clause. It supports assignment to
(optionally nested) tuple patterns, as well as variables.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">$</span> <span class="n">numerals</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">&#39;I&#39;</span><span class="p">,</span> <span class="s1">&#39;II&#39;</span><span class="p">,</span> <span class="s1">&#39;III&#39;</span><span class="p">,</span> <span class="s1">&#39;IV&#39;</span><span class="p">,</span> <span class="s1">&#39;V&#39;</span> <span class="p">]</span>
<span class="k">screen</span> <span class="n">five_buttons</span><span class="p">():</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">numeral</span> <span class="k">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">numerals</span><span class="p">):</span>
<span class="k">textbutton</span> <span class="n">numeral</span> <span class="na">action</span> <span class="n">Return</span><span class="p">(</span><span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<p>The for statement takes an index clause:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">five_buttons</span><span class="p">():</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">numeral</span> <span class="k">index</span> <span class="n">numeral</span> <span class="k">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">numerals</span><span class="p">):</span>
<span class="k">textbutton</span> <span class="n">numeral</span> <span class="na">action</span> <span class="n">Return</span><span class="p">(</span><span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<p>If given, the <code class="docutils literal notranslate"><span class="pre">index</span></code> clause should consist of an expression that returns
a hashable and comparable value that is unique for each row in the list.
Ren'Py uses this value to make sure that transforms and other state wind
up associated with the correct iteration. If you're seeing weird behavior
when elements are added to or removed from a list you're iterating over,
you might want to use an index clause.</p>
</div>
<div class="section" id="if">
<span id="sl-if"></span><h3>If<a class="headerlink" href="#if" title="Permalink to this headline"> link</a></h3>
<p>The screen language <code class="docutils literal notranslate"><span class="pre">if</span></code> statement is the same as the Python/Ren'Py <code class="docutils literal notranslate"><span class="pre">if</span></code>
statement. It supports the <code class="docutils literal notranslate"><span class="pre">if</span></code>, <code class="docutils literal notranslate"><span class="pre">elif</span></code>, and <code class="docutils literal notranslate"><span class="pre">else</span></code> clauses.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">skipping_indicator</span><span class="p">():</span>
<span class="k">if</span> <span class="n">config</span><span class="o">.</span><span class="n">skipping</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Skipping.&quot;</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Not Skipping.&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="on">
<span id="sl-on"></span><h3>On<a class="headerlink" href="#on" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">on</span></code> statement allows the screen to execute an action when an event
occurs. It takes one parameter, a string giving the name of an
event. This should be one of:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">&quot;show&quot;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;hide&quot;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;replace&quot;</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;replaced&quot;</span></code></li>
</ul>
<p>It then takes an action property, giving an action to run if the event
occurs.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">preferences</span><span class="p">():</span>
<span class="k">frame</span><span class="p">:</span>
<span class="k">has</span> <span class="k">hbox</span>
<span class="k">text</span> <span class="s2">&quot;Display&quot;</span>
<span class="k">textbutton</span> <span class="s2">&quot;Fullscreen&quot;</span> <span class="na">action</span> <span class="n">Preferences</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;fullscreen&quot;</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;Window&quot;</span> <span class="na">action</span> <span class="n">Preferences</span><span class="p">(</span><span class="s2">&quot;display&quot;</span><span class="p">,</span> <span class="s2">&quot;window&quot;</span><span class="p">)</span>
<span class="k">on</span> <span class="s2">&quot;show&quot;</span> <span class="na">action</span> <span class="n">Show</span><span class="p">(</span><span class="s2">&quot;navigation&quot;</span><span class="p">)</span>
<span class="k">on</span> <span class="s2">&quot;hide&quot;</span> <span class="na">action</span> <span class="n">Hide</span><span class="p">(</span><span class="s2">&quot;navigation&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="use">
<span id="sl-use"></span><h3>Use<a class="headerlink" href="#use" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">use</span></code> statement allows a screen to include another. The use
statement takes the name of the screen to use. This can optionally be
followed by an argument list, in parenthesis.</p>
<p>If the used screen has no parentheses, it has read and write access
to the scope of the current screen, updated with any keyword arguments
passed via the <code class="docutils literal notranslate"><span class="pre">use</span></code> statement. Otherwise, its scope is initialized
to the result of assigning the arguments to those parameters.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">file_slot</span><span class="p">(</span><span class="n">slot</span><span class="p">):</span>
<span class="k">button</span><span class="p">:</span>
<span class="na">action</span> <span class="n">FileAction</span><span class="p">(</span><span class="n">slot</span><span class="p">)</span>
<span class="k">has</span> <span class="k">hbox</span>
<span class="k">add</span> <span class="n">FileScreenshot</span><span class="p">(</span><span class="n">slot</span><span class="p">)</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">text</span> <span class="n">FileTime</span><span class="p">(</span><span class="n">slot</span><span class="p">,</span> <span class="n">empty</span><span class="o">=</span><span class="s2">&quot;Empty Slot.&quot;</span><span class="p">)</span>
<span class="k">text</span> <span class="n">FileSaveName</span><span class="p">(</span><span class="n">slot</span><span class="p">)</span>
<span class="k">screen</span> <span class="n">save</span><span class="p">():</span>
<span class="k">grid</span> <span class="mi">2</span> <span class="mi">5</span><span class="p">:</span>
<span class="k">for</span> <span class="n">i</span> <span class="k">in</span> <span class="na">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">11</span><span class="p">):</span>
<span class="k">use</span> <span class="n">file_slot</span><span class="p">(</span><span class="n">i</span><span class="p">)</span>
</pre></div>
</div>
<p>The use statement may take one property, <code class="docutils literal notranslate"><span class="pre">id</span></code>, which must be placed
after the parameter list if present. This screen is only useful when
two screens with the same tag use the same screen. In this case,
when one screen replaces the other, the state of the used screen
is transfered from old to new.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">transform</span> <span class="n">t1</span><span class="p">():</span>
<span class="na">xpos</span> <span class="mi">150</span>
<span class="n">linear</span> <span class="mf">1.0</span> <span class="na">xpos</span> <span class="mi">0</span>
<span class="k">screen</span> <span class="n">common</span><span class="p">():</span>
<span class="k">text</span> <span class="s2">&quot;Test&quot;</span> <span class="k">at</span> <span class="n">t1</span>
<span class="k">screen</span> <span class="n">s1</span><span class="p">():</span>
<span class="k">tag</span> <span class="n">s</span>
<span class="k">use</span> <span class="n">common</span> <span class="na">id</span> <span class="s2">&quot;common&quot;</span>
<span class="k">text</span> <span class="s2">&quot;s1&quot;</span> <span class="na">ypos</span> <span class="mi">100</span>
<span class="k">screen</span> <span class="n">s2</span><span class="p">():</span>
<span class="k">tag</span> <span class="n">s</span>
<span class="k">use</span> <span class="n">common</span> <span class="na">id</span> <span class="s2">&quot;common&quot;</span>
<span class="k">text</span> <span class="s2">&quot;s2&quot;</span> <span class="na">ypos</span> <span class="mi">100</span>
<span class="k">label</span> <span class="n">start</span><span class="p">:</span>
<span class="k">show</span> <span class="k">screen</span> <span class="n">s1</span>
<span class="k">pause</span>
<span class="k">show</span> <span class="k">screen</span> <span class="n">s2</span>
<span class="k">pause</span>
<span class="k">return</span>
</pre></div>
</div>
<p>Instead of the name of the screen, the keyword <code class="docutils literal notranslate"><span class="pre">expression</span></code> can be
given, followed by an expression giving the name of the screen to use.
If parameters are required, the <code class="docutils literal notranslate"><span class="pre">pass</span></code> keyword must be given to separate
them from the expression.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">ed</span><span class="p">(</span><span class="n">num</span><span class="p">):</span>
<span class="k">text</span> <span class="s2">&quot;Ed&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Captain&quot;</span>
<span class="k">screen</span> <span class="n">kelly</span><span class="p">(</span><span class="n">num</span><span class="p">):</span>
<span class="k">text</span> <span class="s2">&quot;Kelly&quot;</span>
<span class="k">text</span> <span class="s2">&quot;First Officer&quot;</span>
<span class="k">screen</span> <span class="n">bortus</span><span class="p">(</span><span class="n">num</span><span class="p">):</span>
<span class="k">text</span> <span class="s2">&quot;Bortus&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Second Officer&quot;</span>
<span class="k">screen</span> <span class="n">crew</span><span class="p">():</span>
<span class="k">hbox</span><span class="p">:</span>
<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">member</span> <span class="k">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">party</span><span class="p">):</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">use</span> <span class="k">expression</span> <span class="n">member</span><span class="o">.</span><span class="k">screen</span> <span class="k">pass</span> <span class="p">(</span><span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
</pre></div>
</div>
<div class="section" id="use-and-transclude">
<h4>Use and Transclude<a class="headerlink" href="#use-and-transclude" title="Permalink to this headline"> link</a></h4>
<p>A use statement may also take a block containing screen language statements.
When a block is given, the screen that is used may contain the <code class="docutils literal notranslate"><span class="pre">transclude</span></code>
statement. The <code class="docutils literal notranslate"><span class="pre">transclude</span></code> statement is replaced with the statements
contained within the use statement's block.</p>
<p>This makes it possible to define reusable layouts using screens. For example,
the screen:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">movable_frame</span><span class="p">(</span><span class="na">pos</span><span class="p">):</span>
<span class="k">drag</span><span class="p">:</span>
<span class="na">pos</span> <span class="na">pos</span>
<span class="k">frame</span><span class="p">:</span>
<span class="na">background</span> <span class="n">Frame</span><span class="p">(</span><span class="s2">&quot;movable_frame.png&quot;</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="na">top_padding</span> <span class="mi">20</span>
<span class="k">transclude</span>
</pre></div>
</div>
<p>is meant to be a reusable component that wraps other components. Here's
an example of how it can be used:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">test</span><span class="p">:</span>
<span class="k">use</span> <span class="n">movable_frame</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)):</span>
<span class="k">text</span> <span class="s2">&quot;You can drag me.&quot;</span>
<span class="k">use</span> <span class="n">movable_frame</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">)):</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;You can drag me too.&quot;</span>
<span class="k">textbutton</span> <span class="s2">&quot;Got it!&quot;</span> <span class="na">action</span> <span class="n">Return</span><span class="p">(</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<p>The use and transclude constructs form the basis of
<a class="reference internal" href="screen_python.html#creator-defined-sl"><span class="std std-ref">creator-defined screen language statements</span></a>.</p>
</div>
</div>
<div class="section" id="python">
<span id="sl-python"></span><h3>Python<a class="headerlink" href="#python" title="Permalink to this headline"> link</a></h3>
<p>The screen language also includes single-line and multiple-line Python
statements, which can execute Python. The Python runs in the scope
of the screen.</p>
<p><strong>Python must not cause side effects that are visible from
outside the screen.</strong> Ren'Py will run a screen multiple times, as it
deems necessary. It runs a screen as part of the image prediction
process, before the screen is first shown. As a result, if a screen
has side effects, those side effects may occur at unpredictable times.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">screen</span> <span class="n">python_screen</span><span class="p">:</span>
<span class="k">python</span><span class="p">:</span>
<span class="n">test_name</span> <span class="o">=</span> <span class="s2">&quot;Test </span><span class="si">%d</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">test_number</span>
<span class="k">text</span> <span class="n">test_name</span>
<span class="k">$</span> <span class="n">test_label</span> <span class="o">=</span> <span class="s2">&quot;test_</span><span class="si">%d</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="n">test_label</span>
<span class="k">textbutton</span> <span class="s2">&quot;Run Test&quot;</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="n">test_label</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="showif-statement">
<span id="sl-showif"></span><h2>Showif Statement<a class="headerlink" href="#showif-statement" title="Permalink to this headline"> link</a></h2>
<p>The <code class="docutils literal notranslate"><span class="pre">showif</span></code> statement takes a condition. It shows its children when the
condition is true, and hides the children when the condition is false.
When showif's children have transforms, it will supply them with ATL
events to manage the show and hide process, so that Ren'Py can animate
the show and hide process.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">showif</span></code> statement wraps its children in a displayable that manages
the show and hide process.</p>
<p>Multiple showif statements can be grouped together into a single
<code class="docutils literal notranslate"><span class="pre">showif</span></code>/<code class="docutils literal notranslate"><span class="pre">elif</span></code>/<code class="docutils literal notranslate"><span class="pre">else</span></code> construct, similiar to an if statement.
<strong>Unlike the if statement, showif executes all of its blocks, including Python, even if the condition is false.</strong>
This is because the showif statement needs to create the children that it is
hiding.</p>
<p>Showif delivers three events to its children:</p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">appear</span></code></dt>
<dd>Is delivered if the condition is true when the screen is first shown,
to instantly show the child.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">show</span></code></dt>
<dd>Is delivered when the condition changes from false to true.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">hide</span></code></dt>
<dd>Is delivered when the condition changes from true to false.</dd>
</dl>
<p>For these purposes, the condition of an <code class="docutils literal notranslate"><span class="pre">elif</span></code> clause is always false if any
prior condition is true, while the condition of an else clause is only true
when all prior conditions are false.</p>
<p>For example:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">transform</span> <span class="n">cd_transform</span><span class="p">:</span>
<span class="c1"># This is run before appear, show, or hide.</span>
<span class="na">xalign</span> <span class="mf">0.5</span> <span class="na">yalign</span> <span class="mf">0.5</span> <span class="na">alpha</span> <span class="mf">0.0</span>
<span class="k">on</span> <span class="n">appear</span><span class="p">:</span>
<span class="na">alpha</span> <span class="mf">1.0</span>
<span class="k">on</span> <span class="k">show</span><span class="p">:</span>
<span class="na">zoom</span> <span class="o">.</span><span class="mi">75</span>
<span class="n">linear</span> <span class="o">.</span><span class="mi">25</span> <span class="na">zoom</span> <span class="mf">1.0</span> <span class="na">alpha</span> <span class="mf">1.0</span>
<span class="k">on</span> <span class="k">hide</span><span class="p">:</span>
<span class="n">linear</span> <span class="o">.</span><span class="mi">25</span> <span class="na">zoom</span> <span class="mf">1.25</span> <span class="na">alpha</span> <span class="mf">0.0</span>
<span class="k">screen</span> <span class="n">countdown</span><span class="p">():</span>
<span class="k">default</span> <span class="n">n</span> <span class="o">=</span> <span class="mi">3</span>
<span class="k">vbox</span><span class="p">:</span>
<span class="k">textbutton</span> <span class="s2">&quot;3&quot;</span> <span class="na">action</span> <span class="n">SetScreenVariable</span><span class="p">(</span><span class="s2">&quot;n&quot;</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;2&quot;</span> <span class="na">action</span> <span class="n">SetScreenVariable</span><span class="p">(</span><span class="s2">&quot;n&quot;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;1&quot;</span> <span class="na">action</span> <span class="n">SetScreenVariable</span><span class="p">(</span><span class="s2">&quot;n&quot;</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s2">&quot;0&quot;</span> <span class="na">action</span> <span class="n">SetScreenVariable</span><span class="p">(</span><span class="s2">&quot;n&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="k">showif</span> <span class="n">n</span> <span class="o">==</span> <span class="mi">3</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Three&quot;</span> <span class="na">size</span> <span class="mi">100</span> <span class="k">at</span> <span class="n">cd_transform</span>
<span class="k">elif</span> <span class="n">n</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Two&quot;</span> <span class="na">size</span> <span class="mi">100</span> <span class="k">at</span> <span class="n">cd_transform</span>
<span class="k">elif</span> <span class="n">n</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;One&quot;</span> <span class="na">size</span> <span class="mi">100</span> <span class="k">at</span> <span class="n">cd_transform</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">text</span> <span class="s2">&quot;Liftoff!&quot;</span> <span class="na">size</span> <span class="mi">100</span> <span class="k">at</span> <span class="n">cd_transform</span>
<span class="k">label</span> <span class="n">start</span><span class="p">:</span>
<span class="k">call</span> <span class="k">screen</span> <span class="n">countdown</span>
</pre></div>
</div>
</div>
<div class="section" id="screen-statements">
<h2>Screen Statements<a class="headerlink" href="#screen-statements" title="Permalink to this headline"> link</a></h2>
<p>In addition to the screen statement, there are three Ren'Py script
language statements that involve screens.</p>
<div class="section" id="show-screen">
<h3>Show Screen<a class="headerlink" href="#show-screen" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">show</span> <span class="pre">screen</span></code> statement causes a screen to be shown. It takes an
screen name, and an optional Python argument list. If present, the arguments
are used to initialize the scope of the screen. There are also some
specific keywords passed to <code class="xref py py-func docutils literal notranslate"><span class="pre">show_screen()</span></code> and <code class="xref py py-func docutils literal notranslate"><span class="pre">call_screen()</span></code>.</p>
<p>If the <code class="docutils literal notranslate"><span class="pre">expression</span></code> keyword is given, the expression following it will be evaluated
as the screen name. To pass arguments to the screen with the expression keyword,
separate the expression and arguments with the <code class="docutils literal notranslate"><span class="pre">pass</span></code> keyword.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">$</span> <span class="n">screen_name</span> <span class="o">=</span> <span class="s2">&quot;my_screen&quot;</span>
<span class="k">show</span> <span class="k">screen</span> <span class="k">expression</span> <span class="n">screen_name</span>
<span class="c1"># Or if you need to pass some arguments</span>
<span class="k">show</span> <span class="k">screen</span> <span class="k">expression</span> <span class="n">screen_name</span> <span class="k">pass</span> <span class="p">(</span><span class="s2">&quot;Foo&quot;</span><span class="p">,</span> <span class="n">message</span><span class="o">=</span><span class="s2">&quot;Bar&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>The show screen statement takes an optional <code class="docutils literal notranslate"><span class="pre">nopredict</span></code> keyword, that
prevents screen prediction from occurring. During screen prediction,
arguments to the screen are evaluated. Please ensure that evaluating
the screen arguments does not cause unexpected side-effects to occur.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">If evaluating the arguments to a screen causes side-effects to occur,
your game may behave in unexpected ways.</p>
</div>
<p>Screens shown in this way are displayed until they are explicitly
hidden. This allows them to be used for overlay purposes.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">show</span> <span class="k">screen</span> <span class="n">overlay_screen</span>
<span class="k">show</span> <span class="k">screen</span> <span class="n">clock_screen</span><span class="p">(</span><span class="n">hour</span><span class="o">=</span><span class="mi">11</span><span class="p">,</span> <span class="n">minute</span><span class="o">=</span><span class="mi">30</span><span class="p">)</span>
<span class="k">if</span> <span class="n">rare_case</span><span class="p">:</span>
<span class="k">show</span> <span class="n">rare_screen</span> <span class="n">nopredict</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">show</span> <span class="pre">screen</span></code> statement takes a with clause, which is interpreted in the
same way that the with clause of a <code class="docutils literal notranslate"><span class="pre">show</span></code> statement is.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">show</span> <span class="k">screen</span> <span class="n">clock_screen</span> <span class="k">with</span> <span class="n">dissolve</span>
</pre></div>
</div>
</div>
<div class="section" id="hide-screen">
<h3>Hide Screen<a class="headerlink" href="#hide-screen" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">hide</span> <span class="pre">screen</span></code> statement is used to hide a screen that is currently
being shown. If the screen is not being shown, nothing happens. The with
clause is interpreted the same way the <code class="docutils literal notranslate"><span class="pre">with</span></code> clause of a show statement
is.</p>
<p>Similar to the <code class="docutils literal notranslate"><span class="pre">show</span> <span class="pre">screen</span></code> statement, <code class="docutils literal notranslate"><span class="pre">hide</span> <span class="pre">screen</span></code> also takes the <code class="docutils literal notranslate"><span class="pre">expression</span></code> keyword,
allowing to use an arbitrary expression as the screen name.</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">hide</span> <span class="k">screen</span> <span class="n">rare_screen</span>
<span class="k">hide</span> <span class="k">screen</span> <span class="n">clock_screen</span> <span class="k">with</span> <span class="n">dissolve</span>
<span class="k">hide</span> <span class="k">screen</span> <span class="n">overlay_screen</span>
<span class="k">$</span> <span class="n">screen_name</span> <span class="o">=</span> <span class="s2">&quot;some_screen&quot;</span>
<span class="k">hide</span> <span class="k">screen</span> <span class="k">expression</span> <span class="n">screen_name</span>
</pre></div>
</div>
</div>
<div class="section" id="call-screen">
<h3>Call Screen<a class="headerlink" href="#call-screen" title="Permalink to this headline"> link</a></h3>
<p>The <code class="docutils literal notranslate"><span class="pre">call</span> <span class="pre">screen</span></code> statement shows a screen, and then hides it again at
the end of the current interaction. If the screen returns a value,
then the value is placed in <code class="docutils literal notranslate"><span class="pre">_return</span></code>.</p>
<p>This can be used to display an imagemap. The imagemap can place a
value into the <code class="docutils literal notranslate"><span class="pre">_return</span></code> variable using the <a class="reference internal" href="screen_actions.html#Return" title="Return"><code class="xref py py-func docutils literal notranslate"><span class="pre">Return()</span></code></a> action,
or can jump to a label using the <a class="reference internal" href="screen_actions.html#Jump" title="Jump"><code class="xref py py-func docutils literal notranslate"><span class="pre">Jump()</span></code></a> action.</p>
<p>The call screen statement takes an optional <code class="docutils literal notranslate"><span class="pre">nopredict</span></code> keyword, which
prevents screen prediction from occurring. During screen prediction,
arguments to the screen are evaluated. Please ensure that evaluating
the screen arguments does not cause unexpected side-effects to occur.</p>
<p>In a call screen statement, the <code class="docutils literal notranslate"><span class="pre">with</span></code> clause causes a transition
to occur when the screen is shown.</p>
<p>Since calling a screen is an interaction, and interactions trigger
an implicit <code class="docutils literal notranslate"><span class="pre">with</span> <span class="pre">None</span></code>, using a <code class="docutils literal notranslate"><span class="pre">with</span></code> statement after the
<code class="docutils literal notranslate"><span class="pre">call</span> <span class="pre">screen</span></code> instruction won't make the screen disappear using the
transition, as the screen will already will be gone. To disable the
implicit <code class="docutils literal notranslate"><span class="pre">with</span> <span class="pre">None</span></code> transition, pass the <code class="docutils literal notranslate"><span class="pre">_with_none=False</span></code>
special keyword argument to the screen, as in the example below.</p>
<p>Other ways of triggering transitions also work, such as the
<code class="docutils literal notranslate"><span class="pre">[</span> <span class="pre">With(dissolve),</span> <span class="pre">Return()</span> <span class="pre">]</span></code> action list.</p>
<p>Similar to the <code class="docutils literal notranslate"><span class="pre">show</span> <span class="pre">screen</span></code> statement, <code class="docutils literal notranslate"><span class="pre">call</span> <span class="pre">screen</span></code> also takes the <code class="docutils literal notranslate"><span class="pre">expression</span></code> keyword,
allowing to use an arbitrary expression as the screen name.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">If evaluating the arguments to a screen causes side-effects to occur,
your game may behave in unexpected ways.</p>
</div>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="k">call</span> <span class="k">screen</span> <span class="n">my_imagemap</span>
<span class="k">call</span> <span class="k">screen</span> <span class="n">my_screen</span><span class="p">(</span><span class="n">side_effect_function</span><span class="p">())</span> <span class="n">nopredict</span>
<span class="c1"># Shows the screen with dissolve</span>
<span class="k">call</span> <span class="k">screen</span> <span class="n">my_other_screen</span> <span class="k">with</span> <span class="n">dissolve</span>
<span class="c1"># The screens instantly hides with None, then the pixellate transition executes</span>
<span class="k">with</span> <span class="n">pixellate</span>
<span class="c1"># Shows the screen with dissolve and hides it with pixellate.</span>
<span class="k">call</span> <span class="k">screen</span> <span class="n">my_other_screen</span><span class="p">(</span><span class="n">_with_none</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span> <span class="k">with</span> <span class="n">dissolve</span>
<span class="k">with</span> <span class="n">pixellate</span>
<span class="k">$</span> <span class="n">screen_name</span> <span class="o">=</span> <span class="s2">&quot;my_screen&quot;</span>
<span class="k">call</span> <span class="k">screen</span> <span class="k">expression</span> <span class="n">screen_name</span> <span class="k">pass</span> <span class="p">(</span><span class="n">foo</span><span class="o">=</span><span class="s2">&quot;bar&quot;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="screen-variants">
<span id="id2"></span><h2>Screen Variants<a class="headerlink" href="#screen-variants" title="Permalink to this headline"> link</a></h2>
<p>Ren'Py runs both on traditional mouse-oriented devices such as Windows,
Mac, and Linux PCs, and newer touch-oriented devices such as Android-based
smartphones and tablets. Screen variants allow a game to supply
multiple versions of a screen, and use the version that best matches
the hardware it is running on.</p>
<p>Ren'Py chooses a screen variant to use by searching variants in the
order they are listed in <a class="reference internal" href="config.html#var-config.variants"><code class="xref std std-var docutils literal notranslate"><span class="pre">config.variants</span></code></a>. The first variant
that exists is used.</p>
<p>If the RENPY_VARIANT environment variable is present, config.variants
is initialized by splitting the value of the variable on whitespace,
and then appending <code class="docutils literal notranslate"><span class="pre">None</span></code>. Setting RENPY_VARIANT to a value such as
<code class="docutils literal notranslate"><span class="pre">&quot;medium</span> <span class="pre">tablet</span> <span class="pre">touch&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;small</span> <span class="pre">phone</span> <span class="pre">touch&quot;</span></code> allows screens intended for
Android devices to be tested on a PC.</p>
<p>If the environment variable is not present, a list of variants is
built up automatically, by going through the following list in order
and choosing the entries that apply to the current platform.</p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">&quot;steam_deck&quot;</span></code></dt>
<dd>True if running on a Steam Deck or equivalent hardware.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;steam_big_picture&quot;</span></code></dt>
<dd>True if running in Steam Big Picture mode.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;large&quot;</span></code></dt>
<dd>A screen large enough that relatively small text can be
comfortably read, and buttons can be easily clicked. This
is used for computer screens.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;medium&quot;</span></code></dt>
<dd>A screen where smallish text can be read, but buttons may
need to grow in size so they can be comfortably pressed.
This is used for tablets.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;small&quot;</span></code></dt>
<dd>A screen where text must be expanded in order to be read. This
is used for phones and televisions. (A television might be
physically large, but it's often far away, making it hard
to read.)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;tablet&quot;</span></code></dt>
<dd>Defined on touchscreen based devices where the screen has a
diagonal size of 6 inches or more. (In general, <code class="docutils literal notranslate"><span class="pre">&quot;medium&quot;</span></code> should
be used instead of <code class="docutils literal notranslate"><span class="pre">&quot;tablet&quot;</span></code>.)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;phone&quot;</span></code></dt>
<dd>Defined on touchscreen-based devices where the diagonal size of
the screen is less than 6 inches. On such a small device, it's
important to make buttons large enough a user can easily choose
them. (In general, <code class="docutils literal notranslate"><span class="pre">&quot;small&quot;</span></code> should be used instead of <code class="docutils literal notranslate"><span class="pre">&quot;phone&quot;</span></code>.)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;touch&quot;</span></code></dt>
<dd>Defined on touchscreen-based devices.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;tv&quot;</span></code></dt>
<dd>Defined on television-based devices.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;firetv&quot;</span></code></dt>
<dd>Defined on the Amazon Fire TV console. (<code class="docutils literal notranslate"><span class="pre">&quot;tv&quot;</span></code> and <code class="docutils literal notranslate"><span class="pre">&quot;small&quot;</span></code> are also defined.)</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;chromeos&quot;</span></code></dt>
<dd>Defined when running as an Android app on a Chromebook.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;android&quot;</span></code></dt>
<dd>Defined on all Android devices.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;ios&quot;</span></code></dt>
<dd>Defined on iOS devices, like the iPad (where <code class="docutils literal notranslate"><span class="pre">&quot;tablet&quot;</span></code> and <code class="docutils literal notranslate"><span class="pre">&quot;medium&quot;</span></code>
are also defined) and the iPhone (where <code class="docutils literal notranslate"><span class="pre">&quot;phone&quot;</span></code> and <code class="docutils literal notranslate"><span class="pre">&quot;small&quot;</span></code> are
also defined).</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;mobile&quot;</span></code></dt>
<dd>Defined on mobile platforms, such as Android, iOS and mobile web browsers.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;pc&quot;</span></code></dt>
<dd>Defined on Windows, Mac OS X, and Linux. A PC is expected to have
a mouse and keyboard present, to allow buttons to be hovered, and
to allow precise pointing.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">&quot;web&quot;</span></code></dt>
<dd>Defined when running inside a web browser.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">None</span></code></dt>
<dd>Always defined.</dd>
</dl>
<p>An example of defining a screen variant is:</p>
<div class="highlight-renpy notranslate"><div class="highlight"><pre><span></span><span class="c1"># A variant hello_world screen, used on small touch-based</span>
<span class="c1"># devices.</span>
<span class="k">screen</span> <span class="n">hello_world</span><span class="p">():</span>
<span class="k">tag</span> <span class="n">example</span>
<span class="k">zorder</span> <span class="mi">1</span>
<span class="na">modal</span> <span class="kc">False</span>
<span class="na">variant</span> <span class="s2">&quot;small&quot;</span>
<span class="k">text</span> <span class="s2">&quot;Hello, World.&quot;</span> <span class="na">size</span> <span class="mi">30</span>
</pre></div>
</div>
</div>
<div class="section" id="see-also">
<h2>See also<a class="headerlink" href="#see-also" title="Permalink to this headline"> link</a></h2>
<p><a class="reference internal" href="screen_actions.html"><span class="doc">Screen Actions, Values, and Functions</span></a> : a comprehensive list of actions and other tools
to be used with screens.</p>
<p><a class="reference internal" href="screen_optimization.html"><span class="doc">Screen Language Optimization</span></a> : some useful ways of making screens as
efficient as possible.</p>
<p><a class="reference internal" href="screen_python.html"><span class="doc">Screens and Python</span></a> : go from using Ren'Py's predefined tools, to
extending Ren'Py.</p>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
&copy; Copyright 2012-2022, Tom Rothamel.<br/>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.6.<br/>
</p>
</div>
</footer>
</body>
</html>