I made a pygame, and now I am trying to insert in the website, how do i do that?
Welcome to the forum!
Anvil is a tool for building web apps. It does some things really well, and allows you to write Python where the browser isn’t expecting Python. It does that by using something called Skulpt, which essentially compiles your Python code down to Javascript, which the browser does know how to handle.
Unfortunately, this means that anything running in the client (e.g. a form) must be something that Skulpt supports. There are many Python libraries that Skulpt doesn’t support, and Pygame is one of them as far as I could find.
Typically if you want to run something that Skulpt doesn’t support, you have to find a Javascript version of it. There is a Javascript version of Pygame, Pyjsdl - 0.18 , but I have zero experience with it or what it would be like to integrate into Anvil.
Anvil also includes an iframe component, so if you find some way to run Pygame in a browser outside of Anvil, you could put it into an Anvil form using an iframe.
A quick google search turned up replit.com
https://replit.com/talk/learn/A-Starter-Guide-to-Pygame/11741
Never heard of it, or used it, and I would only suggest trying to write a game for the web with pygame if you really really only wanted to use python.
There are so many free game engines out there that have a one click option to compile your project for web.
replit.com works well for Pygame code (I’ve used that to run a 2d physics simulation package I wrote on top of Pygame), but you have to have a paid plan to have the app always be available. I don’t think the free version would work well as the target for an iframe in an Anvil app.
That’s neat, I had never heard of it before!