Using python with HTML -


i have written python3 implementation of connect4. features ai play against you. runs using module pygame, allows draw objects on window.

i'd have game work on html canvas javascript drawing. akin p5.js.

i'd rather not write whole thing in javascript, since python file runs (and don't want run code client-side security reasons). python offers better functionality this.

is there easy way this?

stack overflow isn't designed general "how do this" type questions. it's more specific "i tried x, expected y, got z instead" type question. i'll try in general sense.

python can't run in web browser. web browsers can run html , javascript. if want program work in web browser, have use html , javascript.

you might able run game on server , use rest api trigger logic client, that's overkil. you're better off rewriting logic in javascript.

there javascript implementation take python code , convert javascript commands. googling "run python in web browser" returns ton of results. in experience, going pretty hit , miss though, , again, best bet rewrite game in javascript.

see also:

please try ask more specific questions in fiture. if you're asking stuff "how do that, , it's implications?" that's question google, not stack overflow. luck.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -