ui.close - Ren'Py

documentation index ◦ reference manual ◦ function index

# ui.close

Function: | ui.close | ():

This closes the currently open widget or layer. If a widget is closed, then we start adding to its parent, or the layer if no parent is open. If a layer is closed, we return to the previously open layer. An error is thrown if we close the last open layer.

## Example

    python:
        # This function actually draws the overlay menu.
        def overlay_menu_func():
            if overlay_menu.shown:

                ui.layer("overlay_menu")

                ui.vbox(xpos=1.0, xanchor="right", ypos=0.75, yanchor="bottom")

                def button(label, target):
                    ui.textbutton(label, clicked=renpy.curried_call_in_new_context(target))

                button("Load Game", "_game_menu_load")
                button("Save Game", "_game_menu_save")
                button("Preferences", "_game_menu_preferences")

                ui.close() # ui.vbox
                ui.close() # ui.layer

documentation index ◦ reference manual ◦ function index