Skip to main content

Python CFFI bindings for Raylib

Project description

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raylib-3.7.0.post10.tar.gz (71.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

raylib-3.7.0.post10-cp310-cp310-win_amd64.whl (624.7 kB view details)

Uploaded CPython 3.10Windows x86-64

raylib-3.7.0.post10-cp310-cp310-manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10

raylib-3.7.0.post10-cp310-cp310-macosx_10_14_x86_64.whl (663.0 kB view details)

Uploaded CPython 3.10macOS 10.14+ x86-64

raylib-3.7.0.post10-cp39-cp39-win_amd64.whl (624.7 kB view details)

Uploaded CPython 3.9Windows x86-64

raylib-3.7.0.post10-cp39-cp39-manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.9

raylib-3.7.0.post10-cp39-cp39-macosx_10_14_x86_64.whl (663.0 kB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

raylib-3.7.0.post10-cp38-cp38-win_amd64.whl (624.7 kB view details)

Uploaded CPython 3.8Windows x86-64

raylib-3.7.0.post10-cp38-cp38-manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8

raylib-3.7.0.post10-cp38-cp38-macosx_10_14_x86_64.whl (662.9 kB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

raylib-3.7.0.post10-cp37-cp37m-win_amd64.whl (624.6 kB view details)

Uploaded CPython 3.7mWindows x86-64

raylib-3.7.0.post10-cp37-cp37m-manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m

raylib-3.7.0.post10-cp37-cp37m-macosx_10_14_x86_64.whl (662.9 kB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

raylib-3.7.0.post10-cp36-cp36m-win_amd64.whl (624.6 kB view details)

Uploaded CPython 3.6mWindows x86-64

raylib-3.7.0.post10-cp36-cp36m-manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.6m

raylib-3.7.0.post10-cp36-cp36m-macosx_10_14_x86_64.whl (662.9 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

Details for the file raylib-3.7.0.post10.tar.gz.

File metadata

  • Download URL: raylib-3.7.0.post10.tar.gz
  • Upload date:
  • Size: 71.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10.tar.gz
Algorithm Hash digest
SHA256 27951a00bddcd01627baab92ae871c02b266143581b6e7ca55b38a8e80b6d000
MD5 291d989867c05433e7166bd14a645eb6
BLAKE2b-256 257baef69d2be7bab65faf7a09c9abf7f75aa1c0b1f0f8a493e2329acfb6ef3b

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-pp37-pypy37_pp73-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for raylib-3.7.0.post10-pp37-pypy37_pp73-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a4f9abbced4e3f29c14332686585ba617cc4f7d105f7421f9535dc20ca634a62
MD5 ca31ebc8ea3f374c52d9f60f9815d1a2
BLAKE2b-256 e75328eab5d6a5263ac7293fe06e72d7c4afd65b062896f82e792a5f48683374

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-pp36-pypy36_pp73-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for raylib-3.7.0.post10-pp36-pypy36_pp73-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 642161b4f287250c385bd8a750c809440cc44fed955e022cf017c5690d6cc928
MD5 7c8f50ef7008915068563df16c8ec334
BLAKE2b-256 4e1f8e9fa9333acc0980338e65b9d6da93c28531f212649688e70be2c9b9043f

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 624.7 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4016196095aa4ca4cfd37f08301b24944a782c1214c29de88eed3467a46a6867
MD5 4287573b8bd7219faf249e6c45bef7f4
BLAKE2b-256 bd2230fde9b817454d21534e634e2da23ac1d90b5c9f78257e55858aed591e78

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp310-cp310-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 25526399f7d8b81e8c6fb7bf1d2b733a9c6f7b016254a79380c76bb34ffefdeb
MD5 27861b433bc3efd076deb60c64b162d6
BLAKE2b-256 8b37e870ad0ca6b577a8280900fa1d4f3e7c443f393f763619ca439f71628dd7

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp310-cp310-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 663.0 kB
  • Tags: CPython 3.10, macOS 10.14+ x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 475a10fe06637ceba6499e682e067cf4efbfd3dee558bbe4803158910cc17dea
MD5 c0dfcb9307cb0bf4383c5d73de9740ac
BLAKE2b-256 4ce0d4232bb5dcc3c774f4325e59b96af4ab784b91bb57b58eb3829742c6a39c

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 624.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 07249bdd1082d8ae85c3e0e7851702de59a30bcaa3ab695a9f3f5d1dd8488289
MD5 f25141e6b51a9d90e5496b3337b0068e
BLAKE2b-256 41cdac4716d04f00788a0e094cb31711878ca45d24855a573b827439880ffe8c

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp39-cp39-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9e82d7a29a27049beb9cfb4e4a523b5c6781c8ba7227ebfaba95726a5574fbec
MD5 40e38535b92e071de6757ef5553f3bad
BLAKE2b-256 d29dbb62e1b3d68f14bd5b08ff0a680bbdeac1fda0c669a6090016f90c586c4e

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 663.0 kB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 45c980ecf4f8c6fa7f7386b495622b051a61b06a2bdce9f93943faae65d28e3f
MD5 e430d589b808b19a9acfcba14f02311d
BLAKE2b-256 73cd8fc8d86e8f9425289b25ac3202f7f016008f2c694d8672569b0c81c43e03

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 624.7 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 eec64dd9cc1c26582a295cdabbad71c528e038fe49d797d563b89af2783d708a
MD5 e5d390d9f395b50f19ae9e81f1bf29b7
BLAKE2b-256 6a494efc5c5a591ba951d1cac68602986510a63edf50b52c6720932d67a3811a

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp38-cp38-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a53a741cbe90bc5c6d10522bb7e9c3d963d85bd1acfe8c918d18e867fbcbd28a
MD5 a7ac8aa910081052a7e38f75015efa81
BLAKE2b-256 282fe1c3e8b1139ac57f3d13679a1e6ac08ffcbb83d4d7acacc8534cb25e77d4

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 662.9 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 da92b132f2ab51e26f8621545eba02542c82369957b47aabad848d2cacea3f3a
MD5 2d547c9f8b5609b2417bb7325e99685f
BLAKE2b-256 d67be2bd1130bd224b42912d30635dbaa03e7c6a774036e055381168caee3b1c

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 624.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 7f29f2e71ec12ead285a75a5cba136bc6999c1b7cb49ccc54068bc0968e7cc55
MD5 c110ac72b34c94159596ca6f34ac34d5
BLAKE2b-256 a194a67e6bdb6237dd97acf85b49656a5727e1576030c9350f2edf7a480bb453

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7m
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a982ae84b23240f795b400dd212d5d0a916a2ab12f470eb58d14301712a55a6e
MD5 76e77ba193da204b432269055936d015
BLAKE2b-256 23cf93a8a08667cfbda18c954a70e1e34bdd06a68b58baef5de96001d618d77d

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 662.9 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f9c2b5b741a345b6e3de0b6f85166fea75c6da63c885d9ea02b11de609e08ddd
MD5 a651a2eda22324656d7f2663c4ae4b4c
BLAKE2b-256 5c0945a65785e2adb6a77cd90475f5279eb51ab05341756fa8e5c7ce45b3974f

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 624.6 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 6ab3acb7151d756c06b533c4160ba5cfe97775085d0cca973ae55cfb0e5e4eef
MD5 b0559a132efc0ccb3943b802ed0a04a9
BLAKE2b-256 b02f7c87f5d87be3122d72acc9d06af583d89a56559c407089789486ec97b584

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp36-cp36m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ed8d23b809baa2d4ba5c2f151e77c2a582b2cef9581cb99064eb50ce1cde7b1a
MD5 c35fb10adee752adde907a0f6c556667
BLAKE2b-256 bdf1b1c862968b9dd8b60b7879e4683c8e6f0c3f4d6fd63e7482ab1b0382978b

See more details on using hashes here.

File details

Details for the file raylib-3.7.0.post10-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: raylib-3.7.0.post10-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 662.9 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using 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

File hashes

Hashes for raylib-3.7.0.post10-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 efb6ae5425b95d2e596ee71bdfe001e15eafb40dab82038aa9946d0ccbb4b0fb
MD5 63a6614d70416eb80f57bc6c186d8981
BLAKE2b-256 7f9ae13da4cc4562ba58430775b94e36c138ce552d622c7752c6f52666725c45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page