• Bob Walance

    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.

    Bob

    posted in Pythonista read more
  • Bob Walance

    When I add the decorator in front of any button's 'def' then that button becomes inactive. I must be doing something wrong.

    Also, you used thread.sleep() in your code. I can't find any documentation on that.

    Thanks for your help on this.

    Bob

    posted in Pythonista read more
  • Bob Walance

    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?

    Thanks much,
    Bob

    posted in Pythonista read more
  • Bob Walance

    Lukas,

    I got it. That works! Thanks.

    May you live to be one-thousand years old, sir.

    Bob

    posted in Pythonista read more
  • Bob Walance

    LK,

    That causes even more errors.

    If, just after:
    ui.load_view('My UI').present('sheet')
    I add:
    view = ui.load_view()

    I get this error:
    [Errno 2] No such file or directory...

    Bob

    posted in Pythonista read more
  • Bob Walance

    Greetings,

    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:


    import ui
    ui.load_view('My UI').present('sheet')

    Connect_button.text = 'Fred'


    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!