Skip to content

Note

Click here to download the full example code

Custom text labels for widgets#

An example showing how to create custom text labels for your widgets.

change label

Out:

<FunctionGui example(x=1, y='hi')>


from magicgui import magicgui


# use a different label than the default (the parameter name) in the UI
@magicgui(x={"label": "widget to set x"})
def example(x=1, y="hi"):
    """Example function."""
    return x, y


example.changed.connect(print)
example.show(run=True)

Total running time of the script: ( 0 minutes 0.049 seconds)

Download Python source code: change_label.py

Download Jupyter notebook: change_label.ipynb

Gallery generated by mkdocs-gallery