Here’s a simple Pong clone written in Python using Pygame, plus step-by-step instructions on how to bundle it into a single Windows .exe using PyInstaller.
1. Prerequisites
Install Python 3.7+
Install required packages:
bash
pip install pygame pyinstaller
2. pong.py (the game source)
Create a file called pong.py and paste in the following:
Use W/S to move the left paddle, ↑/↓ for the right paddle.
4. Bundle into a single pong.exe
In your terminal or PowerShell, cd into the folder containing pong.py.
Run PyInstaller:
bash
pyinstaller --onefile --windowed pong.py
--onefile produces a single EXE.
--windowed prevents a console window from popping up alongside your game.
After it finishes, you’ll find your standalone pong.exe in the dist folder.
🎉 You now have a Windows-compatible Pong game in a single executable! Have fun tinkering with speeds, colors, or even adding sound effects. Let me know if you run into any issues.