pygame-web.github.io

When to use pygame script ?

Create a .html file like this one :

<html><head><meta charset="utf-8"></head><script src="https://pygame-web.github.io/archives/0.2.0/pythons.js" type=module id="site" data-src="fs,vtx,gui" async defer>#<!--

import sys
import platform
import asyncio

async def main():
    for i in range(10):
        print("hi")
        await asyncio.sleep(1)

asyncio.run(main())

embed.run()

# do not change/remove the following comment it is for clearly separating python code from html body
# --></script></html>

mobile demo : https://pygame-web.github.io/showroom/pygame-scripts/org.pygame.touchpong.html

the data-src tags allows for

future tags:

running the script outside browser

simple just type :

python3 -x index.html

formatting my pygame script ?

follow that issue : https://github.com/psf/black/issues/3214

contribute to this page