# How can I publish a Python game on itch.io as html?

I'm making a game with Python, using Pygame. I want to publish my game on itch.io so that it's playable in the browser.

Is there a way to do this? If so, how?

• If you mean How to put a pygame to itch.io, please show us the steps that you tried so far and the error you encountered. If it is why, the answer is opion based and not fitting here. Mar 4, 2021 at 17:59

A game made with Pygame is not playable in the browser. Games made with that tool can be put on itch, but only as a downloadable desktop package, not as a web game.

For completeness, I should mention there are a few projects that aim to get Python/Pygame working in a browser, but I would not call any of these a great option. The most prominent of these projects is Skulpt, and here are some examples of using it with Pygame.

Refer to this existing closely related question.

Since mid-2022, pygame has partial support for WebAssembly as upcoming python3.11 and allows for running the same pygame code on desktops and mobile/web.

To publish your game on itch.io as some people have already done ( as can be seen on https://itch.io/c/2563651/pygame-wasm )

use pygbag from https://pypi.org/project/pygbag , some documentation is available from pygame-web.github.io

read documentation to adjust your main loop for async, and then use python3 -m pygbag game_folder_with_all_extra_modules_and_assets/main.py