• cvp

    @MrObedientDog Pythonista supports PIL, see scikit-image vs pillow

    posted in Pythonista read more
  • cvp

    @JonB It is different because split screen allows your Pythonista to run UI and we also are sure there is no limit of usage nor duration.
    I should still test this "simili-background" mode which is more like a music application or like download in safari or copy in Files app, all of them can use cpu without being visible on the idevice.

    posted in Pythonista read more
  • cvp

    @mikael said:

    Did you have a use case in mind for this?

    Yes, I've a script that uploads files at the same time to Google Drive, Adrive, iMac and an usb flash on my router, and that can take some time, and during this transmission I was not able to use my iPad for other tasks...

    I just wanted to find a way to run Pythonista in background and I had already tried a lot without success.

    posted in Pythonista read more
  • cvp

    @mikael did you try it?

    posted in Pythonista read more
  • cvp

    @backbasic your first quote is not a real quote but un invalid character ‘

    posted in Pythonista read more
  • cvp

    @backbasic said:

    print(‘Hello World”)

    You begin with a quote and end with a double quote...

    posted in Pythonista read more
  • cvp

    You can find my mp4 here

    and download it so

    posted in Pythonista read more
  • cvp

    If you want to create a mp4 from a text, like my example, use

    import images2gif
    import io
    from PIL import Image
    import time
    import ui
    v = ui.View()
    v.frame = (0,0,100,100)
    v.background_color = 'lightgray'
    iv = ui.ImageView()
    iv.frame = v.frame
    t = 'Pythonista runs in   background'
    pil_images = []
    for i in range(len(t)):
        with ui.ImageContext(iv.width, iv.height) as ctx:
            ui_image = ctx.get_image()
            iv.image = ui_image
            pil_image = Image.open(io.BytesIO(ui_image.to_png()))                   
    images2gif.writeGif('a.gif', pil_images, duration=0.2)

    Then convert (online) your gif into mp4, fi here

    posted in Pythonista read more
  • cvp

    Try to start this script, using your own .mp4 video, then open another app (fi Safari) without stopping Pythonista, and come back in a few minutes, you should see in the ui.View title the number of seconds the script has run.

    import ui
    import sys
    import time
    import os
    class MyPictureInPicture(ui.View):
        def __init__(self,main_view, movie_path):
            self.main_view = main_view
            self.frame = (0,0,10,10)
            self.hidden = True
            self.web = ui.WebView()
            mov_url = 'file://' + os.path.expanduser(movie_path)
            html = '''
                <meta name="viewport" content="width=device-width,initial-scale=1">
                <video video {min-height: 400px;} id="videoplayer" loop controls="" autoplay="">
                <source src="mov_url" type="video/mp4">
            html = html.replace('mov_url',mov_url)          
        def set_PiP(self):  
            # wait for it to complete
            while self.web.eval_js('document.readyState')!='complete':
    class MyView(ui.View):
        def __init__(self):
            self.frame = (0,0,400,400)  
            self.background_color = 'yellow'
            self.n = 0  
            self.update_interval = 1        
        def update(self):
            self.n += 1
            self.name = 'Test runs for '+str(self.n)+' secs'
    # Protect against import    
    if __name__ == '__main__':
        mv = MyView()
        myPiP = MyPictureInPicture(mv, '~/Documents/Pythonista_runs_in_background.mp4')

    posted in Pythonista read more
  • cvp

    We cross our posts 😂

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!