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.
Pythonista (seems to?) run in background if script starts a Picture in Picture video
-
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 v.add_subview(iv) v.present('sheet') t = 'Pythonista runs in background' pil_images = [] for i in range(len(t)): with ui.ImageContext(iv.width, iv.height) as ctx: ui.draw_string(t[:i+1],rect=(0,20,100,60),font=('Menlo',16)) ui_image = ctx.get_image() iv.image = ui_image time.sleep(0.1) pil_image = Image.open(io.BytesIO(ui_image.to_png())) #pil_image.show() pil_images.append(pil_image) images2gif.writeGif('a.gif', pil_images, duration=0.2)
Then convert (online) your gif into mp4, fi here
-
You can find my mp4 here
and download it so
-
@mikael did you try it?
-
@cvp, just got around to trying it with a random .mov I had on my phone, and can confirm that it seemed to keep Pythonista alive, at least for 47 seconds.
Did you have a use case in mind for this?
-
@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.
-
@cvp, congratulations. Let us now if you run against some limit, but probably not.
PiP is also cool to have in itself, and I guess even more workable on an iPad than on the phone.
-
Is this any different from, say, split screen?
-
@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. -
Did you find any solution? I am trying to run Pythonista in background as well.
-
@aldoblack no, excepted short scripts running without user interaction and relaunched by a shortcut automation.