Kivy ui/graphics for Windows, unix, android, iOS
ccc last edited by
Do ctypes and objc_util allow us to take a fresher look at integrating Pythonista to Kivy?
Kivy-iOS clearly exists and enables the creation of iOS apps on a Mac but it would be far cooler if you did not need a Mac to build but could use Pythonista alone.
I know that Kivy comes with a license that might be problematic but this integration could be fascinating?
An example iOS app with source code:
dgelessus last edited by
I know that Kivy comes with a license that might be problematic
That's the MIT license, which is one of the least problematic licenses when it comes to reusing and redistributing. It basically says "do whatever you want, as long as it is legal and you redistribute this license as well". It doesn't require you to release your software under the same or a compatible license (unlike e. g. the GPL).
omz last edited by omz
The license is not the problem, but it seems to me that it would be quite difficult to embed kivy in Pythonista. It really seems to be designed for standalone apps where the entire screen and app lifecycle is basically completely taken over by the SDL library... It might be possible, but definitely not trivial to do.
My obscure and impractical idea is to have scripts using Kivy compiled into a standalone app, that is hosted online (localhost) and then side loaded onto the device. But that probably has many things wrong with it.
I think it would make sense as a new product. Drop ui and scene completely and replace them with the Kivy methodology which is designed for cross platform UI development. The editing and file managment parts of Pythonista would still be used and would be invaluable in this Kivy IDE product. You could call it Kivyista or something. If this were avaialble as an App on IOS I would gladly pay for it. This would likely be a project of the scale of Editorial or harder.
@wradcliffe I disagree. I think having TWO apps that function as Python IDEs is silly when the only difference is that one has UI/scene and the other has Kivy. I think integration into 1.7(?) is a good idea, not as a replacement for but as an alternative to scene/UI.
@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.
JonB last edited by
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.
JonB last edited by
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.
kollivier last edited by
@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.
wradcliffe last edited by wradcliffe
@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?
Tizzy last edited by
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.
kollivier last edited by
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. :)