omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Background execution

    Pythonista
    4
    4
    2751
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ihf
      ihf last edited by

      Is it still the case that it is NOT possible to keep a pythonista script (that is waiting for data on a socket) running in the background (app not on screen or screen off)? I recall that there was a way to keep a script running for a short time before IOS would terminate it but I want something that runs persistently in the background waiting for a TCP event.

      1 Reply Last reply Reply Quote 0
      • omz
        omz last edited by

        This is not possible for technical reasons. It‘s just not allowed by Apple, though you could keep the app open while using another one on an iPad (using split screen).

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          out of curiosity, how does the new python keyboard work? does it spawn a new interpreter each time the keyboard is shown?

          On a related topic, @omz, I wonder if you might consider a system to hook custom scripts into widgetPerformUpdateWithCompletionHandler? IIRC that was some a method that get called periodically in the background...

          1 Reply Last reply Reply Quote 0
          • isaingard
            isaingard last edited by

            @ui.in_background
            def button_tapped(sender):
                alert_result = console.alert('Title', 'Message', 'Button 1', 'Button 2')
                sender.title = 'Button ' + str(alert_result)
            

            This is in the documentation for the ui module. Not sure if this is what you are looking for, but it will run the function on a background thread instead of the regular interpreter thread.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors