Trying to create a simple script with UI Designer
I'm brand new to Pythonista and I want to use UI Designer to create a form.
Within UI Designer, I have added a LABEL box to the file 'My UI.pyui', and have changed the LABEL box's 'Name' attribute to 'Connect_label'.
All I want to do is to change the LABEL box's TEXT attribute to "Fred", but I get an error:
"name 'Connect_label' is not defined'
I would have thought that by loading the "My UI" form (and that works) that I could have access to and modify the LABEL box's attributes. Do I need to add something else in the code?
Here's the code:
Connect_button.text = 'Fred'
You can access a views ui elements using the subscript syntax:
view = ui.load_view() view["connect_label"].text = "text" view.present("sheet")
That causes even more errors.
If, just after:
view = ui.load_view()
I get this error:
[Errno 2] No such file or directory...
- you have to replace the ui.load_view().present() line with my code
pyuifile needs to have the same file name as the script you're calling
I got it. That works! Thanks.
May you live to be one-thousand years old, sir.