Forum Archive

How to get a UI control value

TutorialDoctor

I'm trying to keep it simple.

I have a simple script

import ui

view = ui.load_view()
view.present('sheet')

In the UI designer I have a label.

How do I store the label value in a variable. Without defining a function.

label_value = ?

Or the value of any other control.

omz

You mean the text of the label? That would be something like

# ...
label_value = view['label1'].text

(where 'label1' would be the name that you've given to the label in the UI editor)

TutorialDoctor

Thank you so very much Ole!