PyRay is a simple and easy-to-use Python library for game development and multimedia applications. Inspired by raylib, PyRay brings the simplicity of game development to Python with an intuitive API that lets you create games in just a few lines of code.
- Simple and Intuitive - Create a window and start drawing in just 3 lines of code
- Cross-Platform - Works on Windows, macOS, Linux, and Web (via Pyodide)
- 2D Graphics - Shapes, sprites, text rendering, particle systems
- 3D Graphics - Basic 3D shapes, model loading, lighting (via Open3D/PyVista)
- Input Handling - Keyboard, mouse, gamepad support
- Audio System - Sound effects and music playback
- Physics - Built-in 2D physics and collision detection
- Fast - Hardware-accelerated rendering
- Integrations - OpenCV, Matplotlib, Jupyter, Open3D, PyVista support
- Tools - Project generator, migration guides, extensive examples
# Basic installation
pip install pyray
# With optional integrations
pip install pyray[opencv] # Computer vision support
pip install pyray[matplotlib] # Data visualization
pip install pyray[jupyter] # Jupyter notebook support
pip install pyray[all] # Everythingimport pyray
# Create a window
pyray.init_window(800, 600, "My First PyRay Game")
# Game loop
while not pyray.window_should_close():
# Update
x = pyray.get_mouse_x()
y = pyray.get_mouse_y()
# Draw
pyray.begin_drawing()
pyray.clear_background(pyray.BLACK)
pyray.draw_circle(x, y, 20, pyray.RED)
pyray.draw_text("Hello PyRay!", 10, 10, 20, pyray.WHITE)
pyray.end_drawing()
# Cleanup
pyray.close_window()Check out the examples directory for more demos:
Basic Examples:
- Hello World - Your first PyRay program
- Drawing Shapes - Drawing various 2D shapes
- Input Handling - Keyboard and mouse input demo
- Bouncing Ball - Simple physics and trails
- Pong Game - A complete 2-player Pong
Complete Games:
- Snake - Classic snake game with particles
- Tetris - Full Tetris with rotation and line clearing
- Space Shooter - Vertical shooter with power-ups
Integrations:
- OpenCV Webcam - Real-time video filters
- Matplotlib Charts - Live data visualization
- Getting Started Guide
- API Reference (Overview)
- Tutorials
- Integrations: Jupyter & ML
- Deployment Guides
- Roadmap
We welcome contributions! Please see our Contributing Guide for details.
- ✅ Window management
- ✅ Basic 2D graphics (shapes, text)
- ✅ Input system (keyboard, mouse)
- ✅ Sprites & images (load/draw textures)
- ✅ Audio basics (sounds, music)
Read full roadmap and plans:
PyRay is licensed under the MIT License. See LICENSE for details.
- Discord: Join our community
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions and share ideas
PyRay is an open-source project. If you'd like to support its development:
Made with ❤️ by the PyRay community