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.
Porting Pythonista modules to PC
-
About
This is a port of Pythonista-only modules to PC. It will allow you to play games written using scene.py module.
Source
Git repo can be found here
Progress
sound.py - 90%<br>
_scene.py - 51%<br>
_scene_types.py - 30%<br>
console.py - 0%<br>
canvas.py - 0%<br>Help
If you want to help me, please try to find out and explain to me, how
push_matrix
andpop_matrix
functions work :)
I really need them.Currently working on
Images, text and Hydrogen. Text rendering is working fine, and now I am trying to write
load_image
and such stuff.Supported scripts:
Standart library
- Piano.py - built in sounds are required
- Stopwatch.py
- Basic scene
Other scripts
- pull-to-refresh.py
- air-hockey-menu.py
- Some other stuff I don't really remember right now :)
-
I love your idea, unfortunately I am too new to Python to be of much help, but I have bookmarked you on github :)
-
@siddbudd, thanks :). I am currently working on fixing drawing. Because pygame sets start coords to the top-left of the screen, while Pythonista sets it to start coords to down-left of the screen.
Maybe anyone has any ideas how do I do this? Thanks -
@ShadowSlayer, simply use [screen height] - y for any y coordinates and you'll achieve the same y coordinate handling as with Pythonista.
-
This is a great idea! However, I am new to Pythonista and I have installed anaconda on my windows 8. I have put the files in the Anaconda\Lib\site-packages folder. I can't get python to recognize the module when I try 'import scene'. What am I missing?
Thanks -
Hey people! I am finally back with some fixes. Sorry for not being active for such long time, I had some other stuff to do.
@dgelessus, thanks :). I already understood. Thought I had to add a little bit more stuff:
y = size[1] - (y + h)
.@nwinspeare, not very sure what your problem is... I've never used anaconda myself. Try to create some file like mytestfile.py in Anaconda\Lib\site-packages\ and then import it in python:
import mytestfile
. If it gives you error about module not found - Anaconda\Lib\site-packages\ is probably not in your PYTHONPATH.About the new version.
I managed to fix drawing, so now it works just like in Pythonista!
In the next update I am going to add normal text drawing, and maybe something else :)P. S. The piano is now working just as it should, except stroke. I think I am going to write my own function for drawing strokes (it won't be very hard), because when I use stroke in pygame.draw.rect, it gives me VERY weird results.
-
Thank you for posting this, ShadowSlayer!
I was just starting to work on precisely the same thing. I'm teaching my daughter programming using Python and was distressed to find that we had to choose between writing (reasonably) portable code with PyGame or writing scripts that would run on her iPad (fun).
When this layer is complete, we can write to the Pythonista interface and run almost anywhere.
Have you by any chance heard of anybody working on the converse - a python-only layer that provides PyGame-like classes and functions implemented in terms of the Pythonista modules? That would open up a large collection of PyGame apps that could then run on iOS. Presumably it would be much larger undertaking. (And yes, I realize that PyGame is normally implemented as natively-compiled code. This would be an exception.)
Thanks again!
-
Fantastic work, thanks!
-
@ShadowSlayer
push_matrix
andpop_matrix
are used for transforms (translate, scale and rotate) however pyGame provides the pygame.transform functions so it is not necessary as such for these functions in the port. (I am not currently at my main computer to test this). I believe that if you were using a PyOpenGL backend then it would heavily rely onpush
andpop
functions.
However this does raise an issue of the pythonista scene module changes the transformation matrix, were as the pyGamepygame.transform
creates a new surface object.