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.
UI for Pythonista and CPython
-
I am primarily a developper of CPython applications, but find developping and prototyping under Pythonista very convenient when I am not at my Windows desktop.
I would like to use a UI package that is both available under CPython and Pythonista. Apparently neither tkinter nor PyQt are supported on Pythonista.
And the native UI from Pythonista is not available for CPython.Is there any package or trick to use the same UI on both platforms?
-
No. There are TONS of threads on that topic in this forum but the answer is still no.
-
Short answer: You could probably do it, but it wouldn't be easy.
It's very difficult in general to write a single UI library that works on both desktop and mobile, because (aside from Windows UWP) desktop and mobile UIs are usually very different. Even if you stay inside the Apple ecosystem, AppKit (macOS) and UIKit (iOS) are very different in terms of UI design, user input, lifecycle, etc., and it's impossible to write a single app that works on both platforms.
There are some Python UI libraries that work on desktop and mobile, for example Kivy and Toga, though I have almost no experience with both of them.
Kivy is more oriented towards game development I think, so it draws its own UI elements instead of using native ones. It can't be used directly on Pythonista, because it requires compiled code, but someone has written a library called UniPaGE that provides a common API that uses Kivy on desktop and the
ui
module on Pythonista.Toga basically the opposite, one of its main features is that it uses native UI elements on all platforms. The iOS implementation is also pure Python (it uses
ctypes
instead of actual C code) so it could in theory run on Pythonista. This would require some extra code though, because Toga assumes that it's running as a standalone app, so it doesn't work well (or at all) inside Pythonista by default.