I really appreciate all of the tips. I'm a hardware engineer and am learning a lot about programming thanks to people like y'all.
What I ended up doing was just to have the Button action routine set a semaphore that the main routine acts on. This works perfectly and is probably the right thing to do anyway so that main is not bogged down by delays in any of the background tasks.
With the UI Designer's help, I have a simple button and also a label (Record_label).
In the button's Action code:
view["Record_label"].text = "START" # write to the label
time.sleep (2) # delay for a bit
view["Record_label"].text = "END" # write to the label
The problem that I'm having is that I only ever see the text "END" in the label.
However, if I put in a line of code between "START" and "END" that causes an error, the script halts and then I do see the "START" text.
So, I know that the "START" text is getting into the label, but the label's text field is only displaying the last modification (i.e., when the button's action terminates).
Does anyone know what I can do to have the label's text field immediately show what has been written to it?
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'