You've reached a page on the Ren'Py wiki. Due to massive spam, the wiki hasn't been updated in over 5 years, and much of the information here is very out of date. We've kept it because some of it is of historic interest, but all the information relevant to modern versions of Ren'Py has been moved elsewhere.
Some places to look are:
Please do not create new links to this page.
This creates a button that is labelled with some text.
text - The text of this button.
clicked - A function that is called with no arguments when this button is clicked. If it returns a non-None value, then that value is returned from (). If this would add new content to the screen, it's best if this is of the form (UserFunctionThatDisplaysThings): see examples below.
hovered - A function that is called with no arguments when this button is focused. If it returns a non-None value, then that value is returned from ().
unhovered - A function that is called with no arguments when the button loses focus.
text_style - The style that is used for button text.
role - The role this button undertakes. This can be the empty string, or "selected_".
Note that code in the clicked, hovered, and unhovered methods is run inside the current interaction. This means that the screen is not cleared while this code is run. Displayables may be added or removed from the current interaction, provided is called to let Ren'Py know that the interaction has been changed. You should not run code that causes a new interaction from inside these functions, except inside a new context using , , or .
python:
while True:
ui.vbox()
ui.textbutton("Keep going", clicked=ui.returns(("keep", True)), xminimum=250)
ui.textbutton("Finish", clicked=ui.returns(("done", True)), xminimum=250)
ui.close()
type, value = ui.interact()
if type == "done":
break