I'm trying to create a website for a university project where you can play some minigames I've programmed with Pygame (Python). How can I make the games executable online (like flashgames)? I'm using php
-
3Hi! Welcome to StackOverflow! I would suggest you to be more specific in what you need, and also to post whatever attempt you have for what you are trying to achieve. See also How do I ask a good question? and How to create a Minimal, Complete, and Verifiable example.norok2– norok22018-10-01 10:13:52 +00:00Commented Oct 1, 2018 at 10:13
-
You can’t. There is (unfortunately) no way to run Python with pygame as a web application.deets– deets2018-10-02 22:14:46 +00:00Commented Oct 2, 2018 at 22:14
-
I'm also finding a way to realize it, but I only find a good way by web socket.But I think it's will make a delay problem. Skuplt maybe a good way to realize by js. I'm looking for another way.DustyPosa– DustyPosa2019-04-01 03:05:38 +00:00Commented Apr 1, 2019 at 3:05
3 Answers
PYGAME ON WEB(Pygbag)
Now you can run pygame in browser using the pygbag,for more details you can checkout :
For more information you can checkout
- The
pygame-cediscord.(pygame-community discord)
Comments
If you're not fully committed to pygame, you could investigate the pyjsdl project which is modelled on pygame. You'd still have to translate your code.
Another alternative is to create stand-alone executable of your existing pygame projects using pyinstaller and distribute those.
Kivy can generate HTML5 apps, e.g. here's a tutorial on creating pong. It's not really directed at games.
Or you could consider redeveloping using a web game library in a different language (probably javascript).
4 Comments
I have tried several options.
- Trinket.io didn't work well to me since it is cropping the game screen.
- itch.io requires a downloadable file which I didn't have
- I tried to use http://www.skulpt.org/, but it didn't even open.
- So I ended up using replit.com, since this was the only site that didn't crop the game and could host pygame app in browser