Ask coding questions

← Back to all posts
LifeIsOverrated (82)

Will repl ever support the Pygame module for python? That would be amazing!

Answered by sirsnowy7 (8) [earned 5 cycles]
View Answer
masfrost (115)

As @LardBoi metioned, it's not easy to do that. You could potentially have PyGame<->WebGL bindings but it'll probably be incomplete. Maybe in the future we can do something with WASM, but as far as I know you can't have access to the GPU in WASM so we'll end up with a different set of problems. I think if we were to tackle this, we'd start by supporting simple GUI.

If you've been a long time user you'll notice how we focus mostly one thing until we feel like it's feature complete(ish) then when we have enough resources we start engaging with other endeavors. For example, for the longest time we focused on getting text/cli based apps right, now we're focusing on the web side of things (servers backed and static sites). It's not clear when or what we will be doing next but we're always looking to shake things around and see if we can do things better and in a simpler fashion.

LardBoi (34)

I'm not entirely sure if that's even possible. I'm no expert in this field of online Ide's but I do know they can only do so much. Pygame requires a lot of system variables. Like your display and windows. Now if the pygame team made an online version that could make a new window with chrome kinda like how you can with web languages then I would hope they add it in.

LifeIsOverrated (82)

@LardBoi When I tried to run it, it came up with an error about 'no video device'. I can see how the new window would work, but if its anything like turtle, (which they added a while back) I don't think it would be needed. Would be amazing to have though.

LardBoi (34)

@LifeIsOverrated Yeah luckily turtle is handled really well. I think pygame just takes too much for there to be a full web version for support on online IDE's I think the most you can get is maybe a window and some graphics but full on collision might be pushing it. Depends on the computer and network more or less I think. Not too sure on that one though. Also, pygame isn't really meant to be held online. I remember reading a while back on the old pygame website about someone wanting what unity does and adding a pygame webgl or something like that and I'm sure the final answer was like it's not entirely possible. Probably why we haven't seen it pop up over the years of popularity online versions.

PYer (3653)

I hope the include the pygame module!

bridgetsitkoff (1)

As a middle school CS teacher in a Chromebook environment, this would be game changing.