Skip to main content

Python Bindings for Raylib 3.7

New CFFI API static bindings. Automatically generated to be as close as possible to original Raylib. Faster, fewer bugs and easier to maintain than ctypes. Commercial-friendly license. Docstrings and auto-completion.

Full documentation

Quickstart

pip3 install raylib

from pyray import *
init_window(800, 450, "Hello")
while not window_should_close():
    begin_drawing()
    clear_background(WHITE)
    draw_text("Hello world", 190, 200, 20, VIOLET)
    end_drawing()
close_window()

Installation

First make sure you have latest pip installed:

python3 -m pip install --upgrade pip

Then install

python3 -m pip install raylib

On most platforms it should install a binary wheel (Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64).

If yours isn't available then pip will attempt to build from source, in which case you will need to have Raylib development libs installed, e.g. using homebrew, apt, etc.

If it doesn't work, you can build manually.

Dynamic binding version

There is now a separate dynamic version of this binding:

python3 -m pip install raylib_dynamic

Read this before using raylib_dynamic

How to use

There are two APIs, you can use either or both:

If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API

Use the C API.

If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower

Use the Python API.

RLZero

A related library (that is a work in progress!):

A simplified API for Raylib for use in education and to enable beginners to create 3d games

Help wanted

  • Converting more examples from C to Python
  • Testing on more platforms

License (updated)

The bindings are now under the Eclipse Public License, so you are free to statically link and use in non-free / proprietary / commercial projects!

Performance

For fastest performance use Pypy rather than standard Python.

Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating in your update loop and then only convert them to C data structures when you have to call the C functions for drawing.

Bunnymark

Library Implementation Bunnies (60 FPS) Percentage
Raylib 3.7 C 168100 100%
Raylib Python CFFI 3.7 Pypy 3.7 33800 20%
Raylib Python CFFI 3.7 Python 3.9 7700 4.5%
Raylib Python CFFI 3.7 Python 3.9 Nuitka 8600 5.1%
Raylib Python CFFI 3.7 Dynamic Python 3.9 6300 3.7%

Packaging your app

You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:

pip3 install nuitka
cd examples/textures
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py

Advert

RetroWar: 8-bit Party Battle is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.

Coding Games With Pygame Zero & Python is a book for Python beginners.

Release files for raylib 3.7.0.post10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raylib 3.7.0.post10
File Size Uploaded
raylib-3.7.0.post10.tar.gz 71.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for raylib 3.7.0.post10
File
raylib-3.7.0.post10-pp37-pypy37_pp73-manylinux2014_x86_64.whl PyPy 3.7 PyPy 3.7 7.3 Linux glibc 2.17+ x86-64 Details
raylib-3.7.0.post10-pp36-pypy36_pp73-manylinux2014_x86_64.whl PyPy 3.6 PyPy 3.6 7.3 Linux glibc 2.17+ x86-64 Details
raylib-3.7.0.post10-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
raylib-3.7.0.post10-cp310-cp310-manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
raylib-3.7.0.post10-cp310-cp310-macosx_10_14_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.14+ x86-64 Details
raylib-3.7.0.post10-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
raylib-3.7.0.post10-cp39-cp39-manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
raylib-3.7.0.post10-cp39-cp39-macosx_10_14_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.14+ x86-64 Details
raylib-3.7.0.post10-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
raylib-3.7.0.post10-cp38-cp38-manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
raylib-3.7.0.post10-cp38-cp38-macosx_10_14_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.14+ x86-64 Details
raylib-3.7.0.post10-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
raylib-3.7.0.post10-cp37-cp37m-manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
raylib-3.7.0.post10-cp37-cp37m-macosx_10_14_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 Details
raylib-3.7.0.post10-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
raylib-3.7.0.post10-cp36-cp36m-manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
raylib-3.7.0.post10-cp36-cp36m-macosx_10_14_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64 Details

Total release size: 14.1 MB

Release files / raylib-3.7.0.post10.tar.gz

Download URL raylib-3.7.0.post10.tar.gz
Size 71.7 kB
Tags Source
SHA-256 checksum
How to use checksums
27951a00bddcd01627baab92ae871c02b266143581b6e7ca55b38a8e80b6d000
BLAKE2b-256 checksum
How to use checksums
257baef69d2be7bab65faf7a09c9abf7f75aa1c0b1f0f8a493e2329acfb6ef3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-pp37-pypy37_pp73-manylinux2014_x86_64.whl

Download URL raylib-3.7.0.post10-pp37-pypy37_pp73-manylinux2014_x86_64.whl
Size 900.7 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.7 PyPy 3.7 7.3
SHA-256 checksum
How to use checksums
a4f9abbced4e3f29c14332686585ba617cc4f7d105f7421f9535dc20ca634a62
BLAKE2b-256 checksum
How to use checksums
e75328eab5d6a5263ac7293fe06e72d7c4afd65b062896f82e792a5f48683374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-pp36-pypy36_pp73-manylinux2014_x86_64.whl

Download URL raylib-3.7.0.post10-pp36-pypy36_pp73-manylinux2014_x86_64.whl
Size 900.7 kB
Tags Linux glibc 2.17+ x86-64 PyPy 3.6 PyPy 3.6 7.3
SHA-256 checksum
How to use checksums
642161b4f287250c385bd8a750c809440cc44fed955e022cf017c5690d6cc928
BLAKE2b-256 checksum
How to use checksums
4e1f8e9fa9333acc0980338e65b9d6da93c28531f212649688e70be2c9b9043f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp310-cp310-win_amd64.whl

Download URL raylib-3.7.0.post10-cp310-cp310-win_amd64.whl
Size 624.7 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
4016196095aa4ca4cfd37f08301b24944a782c1214c29de88eed3467a46a6867
BLAKE2b-256 checksum
How to use checksums
bd2230fde9b817454d21534e634e2da23ac1d90b5c9f78257e55858aed591e78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp310-cp310-manylinux2014_x86_64.whl

Download URL raylib-3.7.0.post10-cp310-cp310-manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
25526399f7d8b81e8c6fb7bf1d2b733a9c6f7b016254a79380c76bb34ffefdeb
BLAKE2b-256 checksum
How to use checksums
8b37e870ad0ca6b577a8280900fa1d4f3e7c443f393f763619ca439f71628dd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp310-cp310-macosx_10_14_x86_64.whl

Download URL raylib-3.7.0.post10-cp310-cp310-macosx_10_14_x86_64.whl
Size 663.0 kB
Tags CPython 3.10 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
475a10fe06637ceba6499e682e067cf4efbfd3dee558bbe4803158910cc17dea
BLAKE2b-256 checksum
How to use checksums
4ce0d4232bb5dcc3c774f4325e59b96af4ab784b91bb57b58eb3829742c6a39c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp39-cp39-win_amd64.whl

Download URL raylib-3.7.0.post10-cp39-cp39-win_amd64.whl
Size 624.7 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
07249bdd1082d8ae85c3e0e7851702de59a30bcaa3ab695a9f3f5d1dd8488289
BLAKE2b-256 checksum
How to use checksums
41cdac4716d04f00788a0e094cb31711878ca45d24855a573b827439880ffe8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp39-cp39-manylinux2014_x86_64.whl

Download URL raylib-3.7.0.post10-cp39-cp39-manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9e82d7a29a27049beb9cfb4e4a523b5c6781c8ba7227ebfaba95726a5574fbec
BLAKE2b-256 checksum
How to use checksums
d29dbb62e1b3d68f14bd5b08ff0a680bbdeac1fda0c669a6090016f90c586c4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp39-cp39-macosx_10_14_x86_64.whl

Download URL raylib-3.7.0.post10-cp39-cp39-macosx_10_14_x86_64.whl
Size 663.0 kB
Tags CPython 3.9 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
45c980ecf4f8c6fa7f7386b495622b051a61b06a2bdce9f93943faae65d28e3f
BLAKE2b-256 checksum
How to use checksums
73cd8fc8d86e8f9425289b25ac3202f7f016008f2c694d8672569b0c81c43e03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp38-cp38-win_amd64.whl

Download URL raylib-3.7.0.post10-cp38-cp38-win_amd64.whl
Size 624.7 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
eec64dd9cc1c26582a295cdabbad71c528e038fe49d797d563b89af2783d708a
BLAKE2b-256 checksum
How to use checksums
6a494efc5c5a591ba951d1cac68602986510a63edf50b52c6720932d67a3811a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp38-cp38-manylinux2014_x86_64.whl

Download URL raylib-3.7.0.post10-cp38-cp38-manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a53a741cbe90bc5c6d10522bb7e9c3d963d85bd1acfe8c918d18e867fbcbd28a
BLAKE2b-256 checksum
How to use checksums
282fe1c3e8b1139ac57f3d13679a1e6ac08ffcbb83d4d7acacc8534cb25e77d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp38-cp38-macosx_10_14_x86_64.whl

Download URL raylib-3.7.0.post10-cp38-cp38-macosx_10_14_x86_64.whl
Size 662.9 kB
Tags CPython 3.8 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
da92b132f2ab51e26f8621545eba02542c82369957b47aabad848d2cacea3f3a
BLAKE2b-256 checksum
How to use checksums
d67be2bd1130bd224b42912d30635dbaa03e7c6a774036e055381168caee3b1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp37-cp37m-win_amd64.whl

Download URL raylib-3.7.0.post10-cp37-cp37m-win_amd64.whl
Size 624.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
7f29f2e71ec12ead285a75a5cba136bc6999c1b7cb49ccc54068bc0968e7cc55
BLAKE2b-256 checksum
How to use checksums
a194a67e6bdb6237dd97acf85b49656a5727e1576030c9350f2edf7a480bb453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp37-cp37m-manylinux2014_x86_64.whl

Download URL raylib-3.7.0.post10-cp37-cp37m-manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a982ae84b23240f795b400dd212d5d0a916a2ab12f470eb58d14301712a55a6e
BLAKE2b-256 checksum
How to use checksums
23cf93a8a08667cfbda18c954a70e1e34bdd06a68b58baef5de96001d618d77d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp37-cp37m-macosx_10_14_x86_64.whl

Download URL raylib-3.7.0.post10-cp37-cp37m-macosx_10_14_x86_64.whl
Size 662.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
f9c2b5b741a345b6e3de0b6f85166fea75c6da63c885d9ea02b11de609e08ddd
BLAKE2b-256 checksum
How to use checksums
5c0945a65785e2adb6a77cd90475f5279eb51ab05341756fa8e5c7ce45b3974f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp36-cp36m-win_amd64.whl

Download URL raylib-3.7.0.post10-cp36-cp36m-win_amd64.whl
Size 624.6 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
6ab3acb7151d756c06b533c4160ba5cfe97775085d0cca973ae55cfb0e5e4eef
BLAKE2b-256 checksum
How to use checksums
b02f7c87f5d87be3122d72acc9d06af583d89a56559c407089789486ec97b584
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp36-cp36m-manylinux2014_x86_64.whl

Download URL raylib-3.7.0.post10-cp36-cp36m-manylinux2014_x86_64.whl
Size 1.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ed8d23b809baa2d4ba5c2f151e77c2a582b2cef9581cb99064eb50ce1cde7b1a
BLAKE2b-256 checksum
How to use checksums
bdf1b1c862968b9dd8b60b7879e4683c8e6f0c3f4d6fd63e7482ab1b0382978b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / raylib-3.7.0.post10-cp36-cp36m-macosx_10_14_x86_64.whl

Download URL raylib-3.7.0.post10-cp36-cp36m-macosx_10_14_x86_64.whl
Size 662.9 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
efb6ae5425b95d2e596ee71bdfe001e15eafb40dab82038aa9946d0ccbb4b0fb
BLAKE2b-256 checksum
How to use checksums
7f9ae13da4cc4562ba58430775b94e36c138ce552d622c7752c6f52666725c45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release history Release notifications | RSS feed

This release

3.7.0.post10 This release

18 release files

3.7.0

7 release files

3.5.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page