/usr/share/doc/renpy/html/screens.html is in renpy-doc 6.15.7-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Screens and Screen Language — Ren'Py Documentation</title>
<link rel="stylesheet" href="_static/screen.css" type="text/css" media="screen, projection"/>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="print" />
<!--[if lt IE 8]>
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" media="screen, projection"/>
<![endif]-->
<link rel="stylesheet" href="_static/renpydoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '6.15.6',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</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>
<link rel="top" title="Ren'Py Documentation" href="index.html" />
<link rel="next" title="Screen Actions, Values, and Functions" href="screen_actions.html" />
<link rel="prev" title="Styles and Style Properties" href="style.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="screen_actions.html" title="Screen Actions, Values, and Functions"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="style.html" title="Styles and Style Properties"
accesskey="P">previous</a> |</li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
<div class="container">
<div class="span4">
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<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="#add">Add</a></li>
<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="#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="#null">Null</a></li>
<li><a class="reference internal" href="#sl-mousearea">Mousearea</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="#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="#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></li>
<li><a class="reference internal" href="#python">Python</a></li>
</ul>
</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>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="style.html"
title="previous chapter">Styles and Style Properties</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="screen_actions.html"
title="next chapter">Screen Actions, Values, and Functions</a></p>
<h4>Search</h4>
<div id="cse-search-form" style="width: 100%;"></div>
<div class="copydata">
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
<br>
</div>
</div>
</div>
</div>
<div class="document span20 last">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<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">¶</a></h1>
<p>The things that a user sees when looking at a Ren'Py game can be
broken 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.</p>
<p><strong>Screen code must not cause side effects that are visible from
outside the screen.</strong> Ren'Py will run screen code multiple times, as
it deems necessary. It runs screen code as part of the image
prediction process, before the screen is first shown. As a result, if
screen code has side effects, those side effects may occur at
unpredictable times.</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>
<div class="section" id="screen-language">
<h2>Screen Language<a class="headerlink" href="#screen-language" title="Permalink to this headline">¶</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"><div class="highlight"><pre><span class="k">screen</span> <span class="n">say</span><span class="p">:</span>
<span class="k">window</span> <span class="na">id</span> <span class="s">"window"</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="s">"who"</span>
<span class="k">text</span> <span class="n">what</span> <span class="na">id</span> <span class="s">"what"</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.</p>
<p>The screen contains a window, which has been given the id of
"window". This window contains a vertical box, and the spacing inside
that box is 10 pixels. It contains two text fields, one of the name of
the speaker, and the other with the speaker's id.</p>
<div class="section" id="screen-language-syntax">
<h3>Screen Language Syntax<a class="headerlink" href="#screen-language-syntax" title="Permalink to this headline">¶</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 (:), 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">¶</a></h3>
<p>The <cite>screen</cite> 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.</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 giving the variant of screen
to be defined. See <a class="reference internal" href="#screen-variants"><em>Screen Variants</em></a>.</dd>
</dl>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">screen</span> <span class="n">hello_world</span><span class="p">:</span>
<span class="n">tag</span> <span class="n">example</span>
<span class="k">zorder</span> <span class="mi">1</span>
<span class="n">modal</span> <span class="bp">False</span>
<span class="k">text</span> <span class="s">"Hello, World."</span>
</pre></div>
</div>
<p>A screen can take a parameter list:</p>
<div class="highlight-renpy"><div class="highlight"><pre><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>
</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">¶</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">A transform, or list of transforms, that 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</cite></dt>
<dd>If given and true, the displayable is focused by default. Only one
displayable should have this.</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 id is automatically-generated.</p>
</dd>
<dt><cite>style</cite></dt>
<dd>The name of the style applied to this displayable. This may be a
string name, or a style object. The style gives default
values for style properties.</dd>
<dt><cite>style_group</cite></dt>
<dd><p class="first">Style_group is used to provide a prefix to the style of a displayable,
for this displayable and all of its children (unless they have a
more specific group set).</p>
<p>For example, if a vbox has a group of <tt class="docutils literal"><span class="pre">"pref"</span></tt>, then the vbox will
have the style <tt class="docutils literal"><span class="pre">"pref_vbox"</span></tt>, unless a more specific style is
supplied to it. A button inside that vbox would default to the
style <tt class="docutils literal"><span class="pre">"pref_button"</span></tt>.</p>
<p>Styles accessed in this way are automatically created, if they do
not exist. This prevents an error from being signalled.</p>
<p class="last">Setting a group of <tt class="docutils literal"><span class="pre">None</span></tt> disables this behavior for a
displayable and all of its 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>
</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 hover_size property, it sets the text size when the
text is hovered.</p>
<div class="section" id="add">
<span id="sl-add"></span><h3>Add<a class="headerlink" href="#add" title="Permalink to this headline">¶</a></h3>
<p>Adds an image or other displayable to the screen. This optionally
takes <a class="reference internal" href="atl.html#transform-properties"><em>transform properties</em></a>. If at least
one transform property is given, a Transform is created to wrap the
image, and the properties are given to the transform.</p>
<p>This does not take any children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">screen</span> <span class="n">add_test</span><span class="p">:</span>
<span class="k">add</span> <span class="s">"logo.png"</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 class="section" id="bar">
<span id="sl-bar"></span><h3>Bar<a class="headerlink" href="#bar" title="Permalink to this headline">¶</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 BarValue 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"><tt class="xref py py-func docutils literal"><span class="pre">ui.adjustment()</span></tt></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>
</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#bar-style-properties"><em>Bar Style Properties</em></a></li>
</ul>
<p>This does not take children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"sound volume"</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="s">"music volume"</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="s">"voice volume"</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">¶</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. This also controls
if the button is sensitive, and if the button is selected.</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>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#window-style-properties"><em>Window Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#button-style-properties"><em>Button Style Properties</em></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="fixed">
<span id="sl-fixed"></span><h3>Fixed<a class="headerlink" href="#fixed" title="Permalink to this headline">¶</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.html#style-property-xmaximum"><tt class="xref std std-propref docutils literal"><span class="pre">xmaximum</span></tt></a>
and <a class="reference internal" href="style.html#style-property-ymaximum"><tt class="xref std std-propref docutils literal"><span class="pre">ymaximum</span></tt></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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#fixed-style-properties"><em>Fixed Style Properties</em></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"><div class="highlight"><pre><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="s">"Are you sure?"</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="s">"Yes"</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="bp">True</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"No"</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="bp">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">¶</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#window-style-properties"><em>Window Style Properties</em></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"><div class="highlight"><pre><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="s">"Display"</span>
<span class="k">null</span> <span class="na">height</span> <span class="mi">10</span>
<span class="k">textbutton</span> <span class="s">"Fullscreen"</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"fullscreen"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"Window"</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"window"</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">¶</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>
<dt><cite>spacing</cite></dt>
<dd>The spacing between the rows and columns of the grid.</dd>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></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"><div class="highlight"><pre><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="s">"Top-Left"</span>
<span class="k">text</span> <span class="s">"Top-Right"</span>
<span class="k">text</span> <span class="s">"Center-Left"</span>
<span class="k">text</span> <span class="s">"Center-Right"</span>
<span class="k">text</span> <span class="s">"Bottom-Left"</span>
<span class="k">text</span> <span class="s">"Bottom-Right"</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">¶</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#box-style-properties"><em>Box Style Properties</em></a></li>
</ul>
<p>UI displayable children are added to the box.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Left"</span>
<span class="k">text</span> <span class="s">"Right"</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">¶</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 "button_%s.png", and <cite>idle</cite> is omitted, then
idle defaults to "button_idle.png".</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"><tt class="xref std std-var docutils literal"><span class="pre">config.imagemap_auto_function</span></tt></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, and if the button is selected.</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>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#window-style-properties"><em>Window Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#button-style-properties"><em>Button Style Properties</em></a></li>
</ul>
<p>This takes no children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="na">auto</span> <span class="s">"save_</span><span class="si">%s</span><span class="s">.png"</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s">'save'</span><span class="p">)</span>
<span class="k">imagebutton</span> <span class="na">auto</span> <span class="s">"prefs_</span><span class="si">%s</span><span class="s">.png"</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s">'preferences'</span><span class="p">)</span>
<span class="k">imagebutton</span> <span class="na">auto</span> <span class="s">"skip_</span><span class="si">%s</span><span class="s">.png"</span> <span class="na">action</span> <span class="n">Skip</span><span class="p">()</span>
<span class="k">imagebutton</span> <span class="na">auto</span> <span class="s">"afm_</span><span class="si">%s</span><span class="s">.png"</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"auto-forward mode"</span><span class="p">,</span> <span class="s">"toggle"</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">¶</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. This takes no parameters, and the following properties:</p>
<dl class="docutils">
<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>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, "{}".)</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>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#text-style-properties"><em>Text Style Properties</em></a></li>
</ul>
<p>This does not take any children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Enter your name."</span>
<span class="k">input</span> <span class="na">default</span> <span class="s">"Joseph P. Blow, ESQ."</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">¶</a></h3>
<p>This creates a keybinding that runs an action when a key is
pressed. 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 href="#id3"><span class="problematic" id="id4">`Keymap`_</span></a> section for a description of available
keysyms. It takes one property:</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>
</dl>
<p>It takes no children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">screen</span> <span class="n">keymap_screen</span><span class="p">:</span>
<span class="k">key</span> <span class="s">"game_menu"</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s">'save'</span><span class="p">)</span>
<span class="k">key</span> <span class="s">"p"</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s">'preferences'</span><span class="p">)</span>
<span class="k">key</span> <span class="s">"s"</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">¶</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 <tt class="docutils literal"><span class="pre">"_text"</span></tt> 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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#window-style-properties"><em>Window Style Properties</em></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Display"</span>
<span class="k">textbutton</span> <span class="s">"Fullscreen"</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"fullscreen"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"Window"</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"window"</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="null">
<span id="sl-null"></span><h3>Null<a class="headerlink" href="#null" title="Permalink to this headline">¶</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"The title."</span>
<span class="k">null</span> <span class="na">height</span> <span class="mi">20</span>
<span class="k">text</span> <span class="s">"This body text."</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">¶</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 mousearea statement takes not 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>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
</ul>
<p>It does not take children.</p>
<p>Usually, a mousearea statement is given the <a class="reference internal" href="style.html#style-property-area"><tt class="xref std std-propref docutils literal"><span class="pre">area</span></tt></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"><div class="highlight"><pre><span class="k">screen</span> <span class="n">button_overlay</span><span class="p">:</span>
<span class="n">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="s">"buttons"</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="s">"buttons"</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="s">"Save"</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s">"save"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"Prefs"</span> <span class="na">action</span> <span class="n">ShowMenu</span><span class="p">(</span><span class="s">"preferences"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"Skip"</span> <span class="na">action</span> <span class="n">Skip</span><span class="p">()</span>
<span class="k">textbutton</span> <span class="s">"Auto"</span> <span class="na">action</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"auto-forward"</span><span class="p">,</span> <span class="s">"toggle"</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="side">
<span id="sl-side"></span><h3>Side<a class="headerlink" href="#side" title="Permalink to this headline">¶</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 taks 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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></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.html#style-property-xminimum"><tt class="xref std std-propref docutils literal"><span class="pre">xminimum</span></tt></a> or <a class="reference internal" href="style.html#style-property-yminimum"><tt class="xref std std-propref docutils literal"><span class="pre">yminimum</span></tt></a>) to ensure they render at
all.</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"><div class="highlight"><pre><span class="k">screen</span> <span class="n">side_test</span><span class="p">:</span>
<span class="k">side</span> <span class="s">"c tl br"</span><span class="p">:</span>
<span class="k">text</span> <span class="s">"Center"</span>
<span class="k">text</span> <span class="s">"Top-Left"</span>
<span class="k">text</span> <span class="s">"Bottom-Right"</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">¶</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#text-style-properties"><em>Text Style Properties</em></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">screen</span> <span class="n">hello_world</span><span class="p">:</span>
<span class="k">text</span> <span class="s">"Hello, World."</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">¶</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, and if the button is selected.</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>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 <tt class="docutils literal"><span class="pre">"_text"</span></tt> 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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#window-style-properties"><em>Window Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#button-style-properties"><em>Button Style Properties</em></a></li>
</ul>
<p>It does not take children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Wine"</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s">"wine"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"Women"</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s">"women"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"Song"</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s">"song"</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">¶</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>
</dl>
<p>It takes no children.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Yes."</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s">"yes"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"No."</span> <span class="na">action</span> <span class="n">Jump</span><span class="p">(</span><span class="s">"no"</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="s">"too_slow"</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">¶</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="atl.html#transform-properties"><em>Transform Properties</em></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">¶</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"><div class="highlight"><pre><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="s">"sound volume"</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="s">"music volume"</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="s">"voice volume"</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">¶</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#box-style-properties"><em>Box Style Properties</em></a></li>
</ul>
<p>UI displayable children are added to the box.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Top."</span>
<span class="k">text</span> <span class="s">"Bottom."</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">¶</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>If True, the mouse wheel can be used to scroll the viewport.</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="simple">
<li>The first element in the tuple is the distance from</li>
</ul>
<p>the edge of the viewport that edgescrolling begins to take
effect, in pixels.</p>
<ul class="last simple">
<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 0.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 always returns 1.0 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"><tt class="xref py py-func docutils literal"><span class="pre">ui.adjustment()</span></tt></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"><tt class="xref py py-func docutils literal"><span class="pre">ui.adjustment()</span></tt></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 allong 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 "horizontal",
a horizontal scrollbar is placed beneath the viewport. If <cite>scrollbars</cite>
is "vertical", a vertical scrollbar is placed to the right of the
viewport. If <cite>scrollbars</cite> is "both", both horizontal and vertical
scrollbars are created.</p>
<p class="last">If <cite>scrollbars</cite> is not None, the viewport takes properties prefixed
with "<a class="reference internal" href="#side">side</a>". These are passed to the created side layout.</p>
</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></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"><tt class="xref py py-func docutils literal"><span class="pre">XScrollValue()</span></tt></a> and <a class="reference internal" href="screen_actions.html#YScrollValue" title="YScrollValue"><tt class="xref py py-func docutils literal"><span class="pre">YScrollValue()</span></tt></a> with that
id.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">screen</span> <span class="n">viewport_example</span><span class="p">:</span>
<span class="k">side</span> <span class="s">"c b r"</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="s">"vp"</span><span class="p">:</span>
<span class="na">draggable</span> <span class="bp">True</span>
<span class="k">add</span> <span class="s">"washington.jpg"</span>
<span class="k">bar</span> <span class="na">value</span> <span class="n">XScrollValue</span><span class="p">(</span><span class="s">"vp"</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="s">"vp"</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">¶</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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#window-style-properties"><em>Window Style Properties</em></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"><div class="highlight"><pre><span class="k">screen</span> <span class="n">say</span><span class="p">:</span>
<span class="k">window</span> <span class="na">id</span> <span class="s">"window"</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="s">"who"</span>
<span class="k">text</span> <span class="n">what</span> <span class="na">id</span> <span class="s">"what"</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">¶</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"><div class="highlight"><pre><span class="k">screen</span> <span class="n">preferences</span><span class="p">:</span>
<span class="n">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="na">auto</span> <span class="s">"gui_set/gui_prefs_</span><span class="si">%s</span><span class="s">.png"</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">clicked</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"fullscreen"</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">clicked</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"window"</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">clicked</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"transitions"</span><span class="p">,</span> <span class="s">"all"</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">clicked</span> <span class="n">Preference</span><span class="p">(</span><span class="s">"transitions"</span><span class="p">,</span> <span class="s">"none"</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="s">"music volume"</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="s">"sound volume"</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="s">"voice volume"</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="s">"text speed"</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">¶</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 "imagemap_%s.png", and <cite>idle</cite> is omitted, then
idle defaults to "imagemap_idle.png".</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"><tt class="xref std std-var docutils literal"><span class="pre">config.imagemap_auto_function</span></tt></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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#position-style-properties"><em>Position Style Properties</em></a></li>
<li><a class="reference internal" href="style.html#fixed-style-properties"><em>Fixed Style Properties</em></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">¶</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>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>
</dl>
<p>It also takes:</p>
<ul class="simple">
<li><a class="reference internal" href="#common-properties"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#button-style-properties"><em>Button Style Properties</em></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 hotpsot.</p>
</div>
<div class="section" id="hotbar">
<span id="sl-hotbar"></span><h3>Hotbar<a class="headerlink" href="#hotbar" title="Permalink to this headline">¶</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 Value 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"><tt class="xref py py-func docutils literal"><span class="pre">ui.adjustment()</span></tt></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"><em>Common Properties</em></a></li>
<li><a class="reference internal" href="style.html#bar-style-properties"><em>Bar Style Properties</em></a></li>
</ul>
<p>This does not take children.</p>
</div>
</div>
<div class="section" id="advanced-displayables">
<h2>Advanced Displayables<a class="headerlink" href="#advanced-displayables" title="Permalink to this headline">¶</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><tt class="docutils literal"><span class="pre">drag</span></tt></dt>
<dd>Creates a <a class="reference internal" href="drag_drop.html#Drag" title="Drag"><tt class="xref py py-class docutils literal"><span class="pre">Drag</span></tt></a>. A drag can be given an optional child,
or the <a class="reference internal" href="style.html#style-property-child"><tt class="xref std std-propref docutils literal"><span class="pre">child</span></tt></a> style property can be used to supply the child,
and its focused variants.</dd>
<dt><tt class="docutils literal"><span class="pre">draggroup</span></tt></dt>
<dd>Creates a <a class="reference internal" href="drag_drop.html#DragGroup" title="DragGroup"><tt class="xref py py-class docutils literal"><span class="pre">DragGroup</span></tt></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">¶</a></h2>
<p>The has statment 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
<tt class="docutils literal"><span class="pre">has</span></tt> 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"><div class="highlight"><pre><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="s">"sound volume"</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="s">"music volume"</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="s">"voice volume"</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">¶</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 code.</p>
<div class="section" id="default">
<span id="sl-default"></span><h3>Default<a class="headerlink" href="#default" title="Permalink to this headline">¶</a></h3>
<p>The default 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"><div class="highlight"><pre><span class="k">screen</span> <span class="n">message</span><span class="p">:</span>
<span class="na">default</span> <span class="n">message</span> <span class="o">=</span> <span class="s">"No message defined."</span>
<span class="k">text</span> <span class="n">message</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">¶</a></h3>
<p>The for statement is similar to the Python for statment, except that
it does not support the else clause. It supports assignment to
(optionally nested) tuple patterns, as well as variables.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">$</span> <span class="n">numerals</span> <span class="o">=</span> <span class="p">[</span> <span class="s">'I'</span><span class="p">,</span> <span class="s">'II'</span><span class="p">,</span> <span class="s">'III'</span><span class="p">,</span> <span class="s">'IV'</span><span class="p">,</span> <span class="s">'V'</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="ow">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>
</div>
<div class="section" id="if">
<span id="sl-if"></span><h3>If<a class="headerlink" href="#if" title="Permalink to this headline">¶</a></h3>
<p>The screen language if statement is the same as the Python/Ren'Py if
statement. It supports the if, elif, and else clauses.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Skipping."</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">text</span> <span class="s">"Not Skipping."</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">¶</a></h3>
<p>The on 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><tt class="docutils literal"><span class="pre">"show"</span></tt></li>
<li><tt class="docutils literal"><span class="pre">"hide"</span></tt></li>
<li><tt class="docutils literal"><span class="pre">"replace"</span></tt></li>
<li><tt class="docutils literal"><span class="pre">"replaced"</span></tt></li>
</ul>
<p>It then takes an action property, giving an action to run if the event
occurs.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Display"</span>
<span class="k">textbutton</span> <span class="s">"Fullscreen"</span> <span class="na">action</span> <span class="n">Preferences</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"fullscreen"</span><span class="p">)</span>
<span class="k">textbutton</span> <span class="s">"Window"</span> <span class="na">action</span> <span class="n">Preferences</span><span class="p">(</span><span class="s">"display"</span><span class="p">,</span> <span class="s">"window"</span><span class="p">)</span>
<span class="k">on</span> <span class="s">"show"</span> <span class="na">action</span> <span class="n">Show</span><span class="p">(</span><span class="s">"navigation"</span><span class="p">)</span>
<span class="k">on</span> <span class="s">"hide"</span> <span class="na">action</span> <span class="n">Hide</span><span class="p">(</span><span class="s">"navigation"</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">¶</a></h3>
<p>The use 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>The scope of the included code includes the scope of the current
statement's code, updated by assinging the parameters their new
values.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Empty Slot."</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="ow">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>
</div>
<div class="section" id="python">
<span id="sl-python"></span><h3>Python<a class="headerlink" href="#python" title="Permalink to this headline">¶</a></h3>
<p>The screen language also includes single-line and multiple-line python
statements, which can execute python code. This code runs in the scope
of the screen.</p>
<p><strong>Python code must not cause side effects that are visible from
outside the screen.</strong> Ren'Py will run screen code multiple times, as it
deems necessary. It runs screen code as part of the image prediction
process, before the screen is first shown. As a result, if screen code
has side effects, those side effects may occur at unpredictable times.</p>
<div class="highlight-renpy"><div class="highlight"><pre><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="s">"Test </span><span class="si">%d</span><span class="s">"</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="s">"test_</span><span class="si">%d</span><span class="s">"</span> <span class="o">%</span> <span class="n">test_label</span>
<span class="k">textbutton</span> <span class="s">"Run Test"</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="screen-statements">
<h2>Screen Statements<a class="headerlink" href="#screen-statements" title="Permalink to this headline">¶</a></h2>
<p>In addition to the screen statement, there are three Ren'Py script
language statements that involve screens.</p>
<p>Two of these statements take a keyword argument list. This is a python
argument list, in parenthesis, consisting of only keyword
arguments. Positional arguments, extra positional arguments (*), and
extra keyword arguments (**) are not allowed.</p>
<div class="section" id="show-screen">
<h3>Show Screen<a class="headerlink" href="#show-screen" title="Permalink to this headline">¶</a></h3>
<p>The show screen statement causes a screen to be shown. It takes an
screen name, and an optional argument list. If present, the arguments
are used to intialize the scope of the screen.</p>
<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"><div class="highlight"><pre><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>
</pre></div>
</div>
</div>
<div class="section" id="hide-screen">
<h3>Hide Screen<a class="headerlink" href="#hide-screen" title="Permalink to this headline">¶</a></h3>
<p>The hide screen statement is used to hide a screen that is currently
being shown. If the screen is not being shown, nothing happens.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">hide</span> <span class="k">screen</span> <span class="n">overlay_screen</span>
<span class="k">hide</span> <span class="k">screen</span> <span class="n">clock</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">¶</a></h3>
<p>The call screen 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 <cite>_return</cite>.</p>
<p>This can be used to display an imagemap. The imagemap can place a
value into the <cite>_return</cite> variable using the <a class="reference internal" href="screen_actions.html#Return" title="Return"><tt class="xref py py-func docutils literal"><span class="pre">Return()</span></tt></a> action,
or can jump to a label using the <a class="reference internal" href="screen_actions.html#Jump" title="Jump"><tt class="xref py py-func docutils literal"><span class="pre">Jump()</span></tt></a> action.</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="k">call</span> <span class="k">screen</span> <span class="n">my_imagemap</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">¶</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"><tt class="xref std std-var docutils literal"><span class="pre">config.variants</span></tt></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 <tt class="docutils literal"><span class="pre">None</span></tt>. Setting RENPY_VARIANT to a value such as
<tt class="docutils literal"><span class="pre">"tablet</span> <span class="pre">touch"</span></tt> or <tt class="docutils literal"><span class="pre">"phone</span> <span class="pre">touch"</span></tt> 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><tt class="docutils literal"><span class="pre">"tablet"</span></tt></dt>
<dd>Defined on touchscreen based devices where the screen has a
diagonal size of 6 inches or more.</dd>
<dt><tt class="docutils literal"><span class="pre">"phone"</span></tt></dt>
<dd>Defined on touchscren-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.</dd>
<dt><tt class="docutils literal"><span class="pre">"touch"</span></tt></dt>
<dd>Defined on touchscreen-based devices, such as those running the
Android platform.</dd>
<dt><tt class="docutils literal"><span class="pre">"pc"</span></tt></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><tt class="docutils literal"><span class="pre">None</span></tt></dt>
<dd>Always defined.</dd>
</dl>
<p>An example of defining a screen variant is:</p>
<div class="highlight-renpy"><div class="highlight"><pre><span class="c"># A variant hello_world screen, used on small touch-based</span>
<span class="c"># devices.</span>
<span class="k">screen</span> <span class="n">hello_world</span><span class="p">:</span>
<span class="n">tag</span> <span class="n">example</span>
<span class="k">zorder</span> <span class="mi">1</span>
<span class="n">modal</span> <span class="bp">False</span>
<span class="n">variant</span> <span class="s">"touch"</span>
<span class="k">text</span> <span class="s">"Hello, World."</span> <span class="na">size</span> <span class="mi">30</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="screen_actions.html" title="Screen Actions, Values, and Functions"
>next</a> |</li>
<li class="right" >
<a href="style.html" title="Styles and Style Properties"
>previous</a> |</li>
<li> <img src="_static/logo.png" width=19 height=21 align=center>
<li> <a href="http://www.renpy.org/">Ren'Py Home</a> |
<li><a href="index.html">Ren'Py Documentation</a></li>
</ul>
</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en' });
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl('012476843541036121001:gx3sqkoaxkm');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchboxOnly("http://www.google.com/cse?cx=012476843541036121001:gx3sqkoaxkm");
customSearchControl.draw('cse-search-form', options);
}, true);
</script>
</body>
</html>
|