Kivy ui/graphics for Windows, unix, android, iOS
I'm wondering if it would be possible for @omz to add kivy to pythonista. I've been using it on my laptop a lot and love it. It would really help bridge the UI and graphics cross platform. When working on projects at work, pythonista is very handy for ios versions but then I have to go back and create a ui for windows, having a cross platform UI would save a lot of work.
@Webmaster4o - I understand your point of view and actually thought the same way for awhile. I originally thought that Pythonista was a generic Python development platform and assumed it would have some kind of cross platform UI development support. Later it became clear that Pythonista was not designed or targeted at cross platform Python development for its UI approach. It was designed to provide a highly platform specific set of tools as part of its UI IDE. As a product it does this extremely well. It also happens to do a great job support almost any kind of Python development that is not focused on sophisticated Mac UI (i.e. console tools).
Adding another whole UI development toolset would only serve to make it more complex and harder to support. That is why I think another targeted product is in order. This is in keeping with the conventional wisdom that a product needs to do a few things very well. The giant bag of features approach is dead and is a surefire way to kill your product.
I also now understand that merging all the Kivy code into Pythonista would be a huge technical challenge because Apple currently does not allow developers to package up code into libraries that can be dynamically loaded. You have to actually statically link everything together into one big library. This makes things extremely messy and very difficult to maintain. This is also one of the reasons we don't have a Python V3 version of Pythonista.
@wradcliffe , I see your point. Makes sense.
take a look at pybee/toga. not sure how developed this is, but the intent is wrappers around common backends, like cocoa or gtk.
the rubicon/cocoa backend is, i think, mostly usable on pythonista.
Looks interesting @JonB.
@JonB - thanks for pointer. That PyBee project has a lot of interesting components. I will check out toga for sure. They also say they are trying to build a debugging tools - IDE? Weren't you just talking about doing that?
My experience with this so far shows that ctypes code generally "works" now in Pythonista but you have to monkey with the LoadLibrary calls and all that. Maybe we should add some support to fake the usual calls and just do the NSBundle stuff behind the scenes in objc_util.
I thought that most things which are already used by pythonista internally do not require messing with nsbundles, the symbols are already there. ... you can just remove the LoadLibrary calls, or perhaps monkey patch LoadLibrary to not throw an exception. Maybe some obscure apple libraries, but most useful ones i have seen come already loaded by ctypes.cdll
@JonB - CoreMIDI framework is not linked into Pythonista so I needed to NSBundle it in.
I don't know when this trick with NSbundle came to light but it was only recently. It effectively allows you to load dynamic libraries into the namespace of the app which is a non-obvious usage. I think it is intended just to load "resources" like images and such. I don't know.
@wradcliffe I'm actually working on a cross-platform framework I'm calling PyEverywhere for this. Instead of trying to wrap the native UIs for a bunch of platforms, it uses web UI instead, with a bridge layer that lets you call Python functions from JS and vice-versa. This way you can quickly build a cross-platform UI, and have your core app logic remain in Python. It uses Pythonista for iOS support, Kivy for Android support, and wxPython for Mac support. It could be easily extended to support Win as well, and it's on my TODO list, although I'm thinking of using cefpython directly for Windows as wxPython embeds IE by default there, which defaults to emulating IE 7. :(
It's still a work in progress, but you can learn more about it here:
Would love to collaborate with @omz if he had interest, particularly in the area of having some sort of cross-compilation system going for C++ extension modules. I think being able to run a couple commands to get a Python project that will run an app with a cross-platform web-based UI on iOS, Android, Win and Mac could be a game-changer for using Python as an application building tool.
@kollivier - pyeverywhere looks interesting. I have seen a number of attempts to use webviews UI layer for python apps. IPython seems like the most far reaching one. I personally can't look at pceverywhere until you can build directly on ios. I don't own a mac desktop (and don't really want to). I am trying to do all my development directly on the iPad which is why I purchased Pythonista in the first place. As you are probably aware, you can already do webview based UI development with Pythonista. The only issue is the difficulty debugging your app makes it pretty painful. Nobody has stepped up yet with a good JS/HTML5/CSS IDE app for Pythonista yet. Could pceverywhere become that?
I find it interesting that you are using systems other then Kivy for deployment except on Android. Why Kivy on Android, but not on ios? I know that Kivy has a "launcher" app available on Android but you can't sell such an app on ios. Is that the reason?
steps out of shadows awkwardly
I tried building a cross-platform GUI game server administration tool using Kivvy, and came away with the newfound impression that it's only as cross-platform as the libraries you use. I was using pexpect which turns out isn't available on windows really, and actually ever only got it to run on os x and Ubuntu..
Also there isn't really a wysiwyg editor that actually works (at least it wasn't a few months ago).
I much prefer Pythonista's approach to interface design. I also believe it's focus on using native iOS UI elements is one of it's strengths and trying to make it cross platform would water that down. The only way I see pythonista being a good fit for cross platform work is if there's a platform specific wrapper made for each individual platform that somehow allows for the use of iOS elements within all platforms which Apple would probably dislike. If you want to do cross platform work just use kivvy and there's sure to be an iOS script editor/launcher at some point.
My goal is to build a Python cross-platform app development tool, which uses Pythonista to provide cross-platform devs with better integration with iOS. Kivy doesn't seem to integrate well with iOS. For example, it does not look like I can embed a web browser on iOS using Kivy, and that's a necessary feature regardless of if I use it for UI or not, as I need to be able to load web content.
Speaking more generally on cross-platform GUI and WYSIWYG, I've actually contributed to wxPython and wxWidgets, and I can tell you, the workload required to maintain a cross-platform GUI toolkit AND get a solid WYSIWYG tool going is a ton of work, and you're constantly playing catch up as the native platforms add new APIs and functionality. While I wish the Kivy project luck, my past experience says that chances are I'm going to quickly run into roadblocks with support for various native things I want to do. Part of my goal with PyEverywhere is to allow cross-platform Python development in a way that avoids this sort of issue.
As for why HTML/JS/CSS, basically, since almost everyone uses a browser, browsers are the cross-platform GUI toolkits that get the most love by far, are highly performance optimized, and often have much of the device's native functionality exposed. Plus, there's lots of libraries and tools out there to help speed up development and add things like charts, games with sophisticated effects, etc. One of Python's big draws is the ability to pull in modules with lots of advanced functionality, and HTML/JS is the closest I've found to that on the UI side of things.
Anyway, sorry for any misunderstandings! I guess I conflated "developing cross-platform UIs in Pythonista" and "developing cross-platform UIs using Pythonista" in my head when responding. :)