Reference Manual: (offline | online) Quickstart: (offline | online)

# ui.returns

Function: ui.returns( | value)

This function returns a function that, when called, returns the supplied value. It's best used to supply the clicked argument to the various button widgets.

## Example

    init:
        python:
            # This renders an empty slot in the file picker.
            def _render_new_slot(name, save):

                if save:
                    clicked=ui.returns(("return", (name, False)))
                    enable_hover = True
                else:
                    clicked = None
                    enable_hover = True

                ui.button(style='file_picker_entry',
                          clicked=clicked,
                          enable_hover=enable_hover)

                ui.hbox(style='file_picker_entry_box')

                if not config.disable_thumbnails:
                    ui.null(width=config.thumbnail_width,
                            height=config.thumbnail_height)

                ui.text(name + ". ", style='file_picker_old')

                ### file_picker_empty_slot file_picker_text
                # (text) The style that is used for the empty slot indicator
                # in the file picker.
                ui.text(_(u"Empty Slot."), style='file_picker_empty_slot')
                ui.close()

Reference Manual: (offline | online) Quickstart: (offline | online)