UI on desktop
Is it possible to get the Pythonista UI module on a desktop ide?
One would have to write a wrapper around the ui functions and classes, and implement them in Tkinter or another ui framework. It will be nontrivial, and unlikely to exactly match what pythonista is doing, as there is a lot of native behavior going in under the hood.
Someone tried this for the
scenemodule. https://github.com/Vik2015/pythonista-pc It was a good start, but you can see how much was left to do.
sceneis much much simpler than
The Vik2015 project has been relocated as pcista. It is trying to map Scene over to PyGame which is based on SDL and is cross platform. Before ui was part of Pythonista there seemed to be lots of people including Vik2015 trying to create ui like widget sets based on Scene so you will run into lots of abandoned code that has this kind of thing. The author of Pythonista obviously decided that it was better to create a true Python based access layer to the native IOS widgets rather then port Tkinter or Qt or something else. The whole thing makes me wonder now whether the approach taken by Kivy (www.kivy.org) is really the way to go. It also makes me wonder how difficult it would be to merge or host Kivy in Pythonista. Kivy has no IDE of its own but it is working on a shell of some kind.
@wradcliffe, I don't know how exactly Kivy works (never really used it), but I guess it is possible to write a layer on top of
scenewith Kivy-like functions n stuff. It probably won't be able to support all it's features but would be enough to run some basic programs.
P. S. I am the Vik2015 from GitHub :). I kinda abandoned pcista because I didn't really see anyone being interested in it. Thought now it seems like there are more and more people asking for such kind of stuff, so I may try to finish the port.
Yes - it looks like Kivy was off the plate back then due to license issues and there is some heated discussion about it as you read along. It was all about Kivy using LGPL 3, but they switched to an MIT license since then and at least one App is being sold for $75 on IOS that does some pretty fancy process diagramming. Still - the IOS support is not as evolved as the Android support. Lots more Android apps out there using it then IOS. Sure looks like the place to go to get PyGame support done if that ever becomes a goal.
Solution (for mac):
- Download and install Xcode
- Download PythonistaProjectTemplate.zip
- Paste in your script
- Run in a simulator
I know it's kind of awkward, but you can get your pythonista code run on mac!
@ShadowSlayer: I tried pcista to port a simple game I wrote on my phone, but ran into a problem:
translateseems not to be supported, and I use it. Also, pcista looks like it's Python 2 only (
string.uppercaseno longer exists in Python 3). Cool idea though, I'd like to be able to use pcista.
To force the use of Python 2, you can start your file (the VERY FIRST LINE!) with:
#!/usr/bin/env python# on non Pythonista platforms
-- or --
#!python2# on Pythonista
#!/usr/bin/env python2works on Pythonista, Windows, and any Unix that has a
python2in the PATH.