Online Pygame Editor
Make a game in Python and play it a moment later, in the same tab. Online IDE runs pygame-ce on Pyodide, so there is nothing to set up: open Snake, Pong or another example, change a number, press Run and see what happens. The keyboard and mouse work as they do on a desktop, and touch screens get on-screen keys.
How to run Pygame code online
- This page opens with Pygame selected, so you can start typing straight away.
- Write your code in the editor, or open files from your computer: single files, or a whole project as a .zip.
- Press Run, or Ctrl+Enter. The output appears in the panel beside the editor, and when the program asks for input you type it there and press Enter.
- Share a copy with a link, or save your files to your computer.
pygame-ce on Online IDE
- Write a normal pygame program with a game loop and clock.tick(). The same file runs on your computer after pip install pygame-ce.
- Click the game to give it the keyboard. The Examples menu opens a finished game in a new tab and starts it.
- print() goes to the output panel under the game, and input() asks you there.
- Draw with pygame.draw and pygame.font. Image files and sound are not available yet.
Example: a square you move with the arrow keys
import pygame
pygame.init()
screen = pygame.display.set_mode((480, 320))
clock = pygame.time.Clock()
x, y = 225, 145
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
raise SystemExit
keys = pygame.key.get_pressed()
x += (keys[pygame.K_RIGHT] - keys[pygame.K_LEFT]) * 4
y += (keys[pygame.K_DOWN] - keys[pygame.K_UP]) * 4
screen.fill((24, 24, 32))
pygame.draw.rect(screen, (90, 200, 120), (x, y, 30, 30))
pygame.display.flip()
clock.tick(60)
Features of this tool
- Simple and fastA clean, lightweight editor that opens instantly.
- Powered by AceThe Ace code editor, with syntax highlighting, autocompletion and bracket matching.
- Interactive programsType input into the terminal while your program runs.
- Several filesWork in tabs, open files or a .zip from your computer, and save the project back to disk.
- Made for learningHelpful for beginners to learn and practice programs.
- Light and dark themesPlus 39 editor themes, a choice of coding fonts, and Vim, Emacs or VS Code keys.
- Keep your outputCopy or download the program output in one click.
- Share by linkSave your code in the cloud and open it anywhere.
Frequently asked questions
Do I need to install pygame?
No. pygame-ce, the maintained community edition of pygame, loads in your browser together with Python the first time you press Run.
Will my game also run on my own computer?
Yes. It is ordinary pygame code. Download the file, run pip install pygame-ce on your computer, and start it with Python.
Does it work on a phone?
Yes. Touch screens get on-screen arrow keys and a Space key, plus any other keys your program uses. The Tabs layout gives the game the whole screen.
Can I use images and sound?
Not yet. Draw with pygame.draw and pygame.font for now. Sound from pygame.mixer does not play on this page.
How do I show someone my game?
Press Share to get a link. Anyone who opens it can read the code, play the game and change it.
More Python graphics tools
Contact us
For any feedback, queries or issues, please feel free to contact us or write to . We value your input and are committed to providing the best possible experience for our users.