docs
Directory actions
More options
Directory actions
More options
docs
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Python Bindings for Raylib 5.0 — Raylib Python documentation</title>
<link rel="stylesheet" type="text/css" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fpygments.css%3Fv%3Dfa44fd50" />
<link rel="stylesheet" type="text/css" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fcss%2Ftheme.css%3Fv%3D19f00094" />
<link rel="stylesheet" type="text/css" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fgraphviz.css%3Fv%3Deafc0fe6" />
<!--[if lt IE 9]>
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fjs%2Fhtml5shiv.min.js"></script>
<![endif]-->
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fjquery.js%3Fv%3D5d32c60e"></script>
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2F_sphinx_javascript_frameworks_compat.js%3Fv%3D2cd50e6c"></script>
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fdocumentation_options.js%3Fv%3D5929fcd5"></script>
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fdoctools.js%3Fv%3D888ff710"></script>
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fsphinx_highlight.js%3Fv%3Ddc90522c"></script>
<script src="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_static%2Fjs%2Ftheme.js"></script>
<link rel="index" title="Index" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fgenindex.html" />
<link rel="search" title="Search" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fsearch.html" />
<link rel="next" title="Python API" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fpyray.html" />
<link rel="prev" title="Raylib Python" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Findex.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Findex.html" class="icon icon-home">
Raylib Python
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fsearch.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23">Python Bindings for Raylib 5.0</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23quickstart">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23installation">Installation</a><ul>
<li class="toctree-l2"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23raspberry-pi">Raspberry Pi</a></li>
<li class="toctree-l2"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23dynamic-binding-version">Dynamic binding version</a></li>
<li class="toctree-l2"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23beta-testing">Beta testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23problems">Problems?</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23how-to-use">How to use</a><ul>
<li class="toctree-l2"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API</a></li>
<li class="toctree-l2"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower">If you prefer a slightly more Pythonistic API and don’t mind it might be slightly slower</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23app-showcase">App showcase</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23rlzero">RLZero</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23help-wanted">Help wanted</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23license-updated">License (updated)</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23performance">Performance</a><ul>
<li class="toctree-l2"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23bunnymark">Bunnymark</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23packaging-your-app">Packaging your app</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23advert">Advert</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fpyray.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fraylib.html">C API</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdynamic.html">Dynamic Bindings</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2FBUILDING.html">Building from source</a></li>
<li class="toctree-l1"><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2FRPI.html">Raspberry Pi</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Findex.html">Raylib Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Findex.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Python Bindings for Raylib 5.0</li>
<li class="wy-breadcrumbs-aside">
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F_sources%2FREADME.md.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="python-bindings-for-raylib-5-0">
<h1>Python Bindings for Raylib 5.0<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23python-bindings-for-raylib-5-0" title="Link to this heading"></a></h1>
<p>New CFFI API static bindings.</p>
<ul class="simple">
<li><p>Automatically generated to be as close as possible to
original Raylib.</p></li>
<li><p>Faster, fewer bugs and easier to maintain than ctypes.</p></li>
<li><p>Commercial-friendly license.</p></li>
<li><p>Docstrings and auto-completion.</p></li>
<li><p><strong>Now includes extra libraries: raymath, raygui, rlgl and physac</strong></p></li>
</ul>
<p><a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"http://electronstudio.github.io/raylib-python-cffi">Full" rel="nofollow">http://electronstudio.github.io/raylib-python-cffi">Full documentation</a></p>
</section>
<section id="quickstart">
<h1>Quickstart<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23quickstart" title="Link to this heading"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">pip3</span> <span class="pre">install</span> <span class="pre">raylib</span></code></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>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()
</pre></div>
</div>
</section>
<section id="installation">
<h1>Installation<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23installation" title="Link to this heading"></a></h1>
<p>First make sure you have the latest pip installed:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install --upgrade pip
</pre></div>
</div>
<p>Then install</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install setuptools
python3 -m pip install raylib
</pre></div>
</div>
<p>On most platforms it should install a binary wheel (Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64).</p>
<p>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.</p>
<section id="raspberry-pi">
<h2>Raspberry Pi<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23raspberry-pi" title="Link to this heading"></a></h2>
<p><a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2FRPI.html"><span class="std std-doc">Using on Rasperry Pi</span></a></p>
</section>
<section id="dynamic-binding-version">
<h2>Dynamic binding version<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23dynamic-binding-version" title="Link to this heading"></a></h2>
<p>There is now a separate dynamic version of this binding:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib_dynamic
</pre></div>
</div>
<p>It works on some systems where the static version doesn’t, <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://electronstudio.github.io/raylib-python-cffi/dynamic.html">but" rel="nofollow">https://electronstudio.github.io/raylib-python-cffi/dynamic.html">but be sure to read these caveats before using it</a></p>
</section>
<section id="beta-testing">
<h2>Beta testing<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23beta-testing" title="Link to this heading"></a></h2>
<p>If you find a bug, it may be fixed in the <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://github.com/electronstudio/raylib-python-cffi/releases">latest">https://github.com/electronstudio/raylib-python-cffi/releases">latest dev release</a>.
You can install an alpha or beta version by specifying the exact version number like this:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m pip install raylib==4.2.0.0.dev4
</pre></div>
</div>
</section>
<section id="problems">
<h2>Problems?<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23problems" title="Link to this heading"></a></h2>
<p>If it doesn’t work, <a class="reference internal" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2FBUILDING.html"><span class="std std-doc">try to build manually.</span></a>. If that works then <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://github.com/electronstudio/raylib-python-cffi/issues">submit">https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>
to let us know what you did.</p>
<p>If you need help you can try asking <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://discord.gg/raylib">on" rel="nofollow">https://discord.gg/raylib">on Discord</a>.</p>
<p>If it still doesn’t work, <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://github.com/electronstudio/raylib-python-cffi/issues">submit">https://github.com/electronstudio/raylib-python-cffi/issues">submit an issue</a>.</p>
</section>
</section>
<section id="how-to-use">
<h1>How to use<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23how-to-use" title="Link to this heading"></a></h1>
<p>There are two APIs, you can use either or both:</p>
<section id="if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api">
<h2>If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23if-you-are-familiar-with-c-coding-and-the-raylib-c-library-and-you-want-to-use-an-exact-copy-of-the-c-api" title="Link to this heading"></a></h2>
<p>Use <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://electronstudio.github.io/raylib-python-cffi/raylib.html">the" rel="nofollow">https://electronstudio.github.io/raylib-python-cffi/raylib.html">the C API</a>.</p>
</section>
<section id="if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower">
<h2>If you prefer a slightly more Pythonistic API and don’t mind it might be slightly slower<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23if-you-prefer-a-slightly-more-pythonistic-api-and-don-t-mind-it-might-be-slightly-slower" title="Link to this heading"></a></h2>
<p>Use <a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://electronstudio.github.io/raylib-python-cffi/pyray.html">the" rel="nofollow">https://electronstudio.github.io/raylib-python-cffi/pyray.html">the Python API</a>.</p>
</section>
</section>
<section id="app-showcase">
<h1>App showcase<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23app-showcase" title="Link to this heading"></a></h1>
<p><a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://github.com/pkulev/tanki">Tanki</a></p">https://github.com/pkulev/tanki">Tanki</a></p>
<p><a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://pebaz.itch.io/alloy-bloxel-editor">Alloy" rel="nofollow">https://pebaz.itch.io/alloy-bloxel-editor">Alloy Bloxel Editor</a></p>
<p>Add your app here!</p>
</section>
<section id="rlzero">
<h1>RLZero<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23rlzero" title="Link to this heading"></a></h1>
<p>A related library (that is a work in progress!):</p>
<p><a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://github.com/electronstudio/rlzero">A">https://github.com/electronstudio/rlzero">A simplified API for Raylib for use in education and to enable beginners to create 3d games</a></p>
</section>
<section id="help-wanted">
<h1>Help wanted<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23help-wanted" title="Link to this heading"></a></h1>
<ul class="simple">
<li><p>Converting more examples from C to Python</p></li>
<li><p>Testing on more platforms</p></li>
</ul>
</section>
<section id="license-updated">
<h1>License (updated)<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23license-updated" title="Link to this heading"></a></h1>
<p>The bindings are now under the Eclipse Public License, so you are free to
statically link and use in non-free / proprietary / commercial projects!</p>
</section>
<section id="performance">
<h1>Performance<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23performance" title="Link to this heading"></a></h1>
<p>For fastest performance use Pypy rather than standard Python.</p>
<p>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.</p>
<section id="bunnymark">
<h2>Bunnymark<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23bunnymark" title="Link to this heading"></a></h2>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Library</p></th>
<th class="head"><p>Implementation</p></th>
<th class="head"><p>Bunnies (60 FPS)</p></th>
<th class="head"><p>Percentage</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Raylib 3.7</p></td>
<td><p>C</p></td>
<td><p>168100</p></td>
<td><p>100%</p></td>
</tr>
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7</p></td>
<td><p>Pypy 3.7</p></td>
<td><p>33800</p></td>
<td><p>20%</p></td>
</tr>
<tr class="row-even"><td><p>Raylib Python CFFI 3.7</p></td>
<td><p>Python 3.9</p></td>
<td><p>7700</p></td>
<td><p>4.5%</p></td>
</tr>
<tr class="row-odd"><td><p>Raylib Python CFFI 3.7</p></td>
<td><p>Python 3.9 Nuitka</p></td>
<td><p>8600</p></td>
<td><p>5.1%</p></td>
</tr>
<tr class="row-even"><td><p>Raylib Python CFFI 3.7 Dynamic</p></td>
<td><p>Python 3.9</p></td>
<td><p>6300</p></td>
<td><p>3.7%</p></td>
</tr>
</tbody>
</table>
</section>
</section>
<section id="packaging-your-app">
<h1>Packaging your app<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23packaging-your-app" title="Link to this heading"></a></h1>
<p>You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip3 install nuitka
cd examples/textures
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
</pre></div>
</div>
</section>
<section id="advert">
<h1>Advert<a class="headerlink" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fdocs%23advert" title="Link to this heading"></a></h1>
<p><a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git">RetroWar" rel="nofollow">https://store.steampowered.com/app/664240/RetroWar_8bit_Party_Battle/?git">RetroWar: 8-bit Party Battle</a> is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.</p>
<p><a class="reference external" href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://github.com/electronstudio/pygame-zero-book">Coding">https://github.com/electronstudio/pygame-zero-book">Coding Games With Pygame Zero & Python</a> is
a book for Python beginners.</p>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Findex.html" class="btn btn-neutral float-left" title="Raylib Python" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2Fpyray.html" class="btn btn-neutral float-right" title="Python API" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>© Copyright 2021, Richard Smith.</p>
</div>
Built with <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://www.sphinx-doc.org/">Sphinx</a" rel="nofollow">https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://github.com/readthedocs/sphinx_rtd_theme">theme</a">https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Felectronstudio%2Fraylib-python-cffi%2Ftree%2Fdetached%2F%3Ca+href%3D"https://readthedocs.org">Read" rel="nofollow">https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>