Package: raylib
Python Bindings for Raylib 5.0New 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.Now includes extra libraries: raymath, raygui, rlgl and physacFull documentationQuickstartpip3 install raylibfrom 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()InstallationFirst make sure you have the latest pip installed:python3 -m pip install --upgrade pipThen installpython3 -m pip install setuptools
python3 -m pip install raylibOn 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.Raspberry PiUsing on Rasperry PiDynamic binding versionThere is now a separate dynamic version of this binding:python3 -m pip install raylib_dynamicIt works on some systems where the static version doesn't,but be sure to read these caveats before using itBeta testingIf you find a bug, it may be fixed in thelatest dev release.
You can install an alpha or beta version by specifying the exact version number like this:python3 -m pip install raylib==4.2.0.0.dev4Problems?If it doesn't work,try to build manually..  If that works thensubmit an issueto let us know what you did.If you need help you can try askingon Discord.If it still doesn't work,submit an issue.How to useThere 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 APIUsethe C API.If you prefer a slightly more Pythonistic API and don't mind it might be slightly slowerUsethe Python API.App showcaseTankiAlloy Bloxel EditorAdd your app here!RLZeroA related library (that is a work in progress!):A simplified API for Raylib for use in education and to enable beginners to create 3d gamesHelp wantedConverting more examples from C to PythonTesting on more platformsLicense (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!PerformanceFor 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.BunnymarkLibraryImplementationBunnies (60 FPS)PercentageRaylib 3.7C168100100%Raylib Python CFFI 3.7Pypy 3.73380020%Raylib Python CFFI 3.7Python 3.977004.5%Raylib Python CFFI 3.7Python 3.9 Nuitka86005.1%Raylib Python CFFI 3.7 DynamicPython 3.963003.7%Packaging your appYou 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.pyAdvertRetroWar: 8-bit Party Battleis out now.  Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.Coding Games With Pygame Zero & Pythonis
a book for Python beginners.