Notice: Undefined offset: 3681886 in /var/www/html/qa-external/qa-external-users.php on line 744
onlinegdb wont let me use pygame - OnlineGDB Q&A
Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed onlinegdb wont let me use pygame

+10 votes
asked Mar 15, 2022 by Sam (1,420 points)
closed Oct 13, 2025 by Admin
do u know a website where I can use pygame
closed with the note: answered

3 Answers

+1 vote
answered Oct 10, 2025 by Admin (5,870 points)
selected Oct 13, 2025 by Admin
 
Best answer
Now pygame is supported.
Example: https://onlinegdb.com/XXFAAuTpVw
Use "Run with display screen" button to run pygame program.
commented Oct 16, 2025 by E (530 points)
Still gives me an error…
commented Oct 16, 2025 by E (530 points)
Gives this error: [?2004l
<frozen importlib._bootstrap>:488: RuntimeWarning: Your system i avx2 capable but pygame was not built with support for it. The performance of some of your blits could be adversely affected. Consider enabling compile time detection with environment variables like PYGAME_DETECT_AVX2=1 if you are compiling without cross compilation.
pygame 2.6.1 (SDL 2.32.56, Python 3.13.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
ftruncate() failed: File too large
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2793:(snd_pcm_open_noupdate) Unknown PCM default
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Traceback (most recent call last):
  File "/home/main.py", line 4, in <module>
    screen = pygame.display.set_mode((400, 300))
pygame.error: No available video device
[?2004h
commented Oct 16, 2025 by Admin (5,870 points)
Looks like you ran with regular "Run" button.
For display screen, there is sub-option available along side "Run" button which will allow option to "Run with display screen".
+1 vote
answered Mar 16, 2022 by Peter Minarik (101,360 points)
Why not download and install Python on your own computer so you can control what packages are installed and what not?

https://www.python.org/downloads/
commented Mar 16, 2022 by Sam (1,420 points)
the only time i'm on a computer is at school so I can't do that until I get my own
commented Mar 16, 2022 by Peter Minarik (101,360 points)
I see.

I did a bit of searching online and this seems to work:

https://trinket.io/features/pygame

Good luck!
+1 vote
answered Apr 2, 2022 by userdotexe (1,340 points)

OnlineGDB currently doesn't have a gui for pygame, tkinter, or anything similar (like java swing, etc), but I found a few sites that support it.

:)
commented Oct 9, 2025 by E (530 points)
I was wondering this too because i wanted to make a game in python so thanks a lot! :3
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...