pygame wasm

When to use pygbag script ?

Create a .html file like this one :

<html><head><meta charset="utf-8"></head><script src="https://pygame-web.github.io/archives/0.7/pythons.js" type=module id="site" data-os="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())

# 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-os tags allows for

the data-python tag:

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 done, now you can use black -x -l 132 to format your code

contribute to this page