Skip to main content

pysdl2-cffi is a Python wrapper for SDL2 written using cffi, featuring:

  • A cffi interface to the underlying SDL2 libraries.

  • Automatically generated, consistent helper functions for SDL2, SDL_image, SDL_mixer, and SDL_ttf that hide most allocation and dereferencing.

  • Useful docstrings on every function, including the C function signature and (for SDL2 only) the library’s original doxygen documentation reformatted as Sphinx restructured text.

  • A small collection of libSDL2’s original example / test programs converted to Python using Eric S. Raymond’s ctopy.

The goal is to provide a flat, consistent, faithful-to-C binding with some more-Pythonic renaming and conveniences.

This wrapper won’t contain anything that doesn’t directly translate to part of the library’s API. The goal is to be a dependency for something like pygame, not a replacement.

This library should be compatible with Linux, OSX and Windows.

This library is licensed under the GPLv2 or (at your option) any later version. Alternatively a commercial license can be purchased from the author for $10.

Install with pip, or download from https://pypi.python.org/pypi/pysdl2-cffi

Source hosted at https://bitbucket.org/dholth/pysdl2-cffi

Documentation hosted at https://pythonhosted.org/pysdl2-cffi

0.8.0

  • The wrapper is now built with cffi 1.1’s verify() mode and requires a C compiler to build. It is much faster than the previous version on CPython.

  • Appveyor-built binary packages now available on Windows. On Windows, the necessary SDL2 DLLs are now a pip-installed dependency.

0.7.0

  • Struct wrappers now expose all the attributes of the C-level struct as properties. Great for tinkering, as the property names can now be inspected interactively.

  • Struct wrappers no longer pass all attribute access through getattr/setattr. Arbitrary data can be attached to the struct wrappers as is customary in Python.

  • Fix a capitalization error for the “classy” API to conform to the general binding rules. ob.gL_Function is now ob.GL_Function.

0.6.0

  • Windows is now supported! You must manually download the SDL2 dll’s and place them on PATH set PATH=%PATH%;C:\users\me\SDL2Dir but pysdl2-cffi will attempt to load the Windows .dll as well as the Unix .so.

0.5.1

  • Enums are no longer wrapped in (nonexistent) classes

  • Python 2 can also pass Unicode where char* is required; automatically encoded to utf-8.

Release files for pysdl2-cffi 0.8.0

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

Source distribution (sdist)

Source distribution for pysdl2-cffi 0.8.0
File Size Uploaded
pysdl2-cffi-0.8.0.tar.gz 195.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pysdl2-cffi 0.8.0
File
pysdl2_cffi-0.8.0-cp34-none-win_amd64.whl CPython 3.4 none Windows x86-64 Details
pysdl2_cffi-0.8.0-cp34-none-win32.whl CPython 3.4 none Windows x86-32 Details
pysdl2_cffi-0.8.0-cp27-none-win_amd64.whl CPython 2.7 none Windows x86-64 Details
pysdl2_cffi-0.8.0-cp27-none-win32.whl CPython 2.7 none Windows x86-32 Details

Total release size: 1.3 MB

Release files / pysdl2-cffi-0.8.0.tar.gz

Download URL pysdl2-cffi-0.8.0.tar.gz
Size 195.3 kB
Tags Source
SHA-256 checksum
How to use checksums
18d4fc2f8cf19818a89b0e3461c3ad47bc78414dc9c1f58917cc4efa7dd8b985
BLAKE2b-256 checksum
How to use checksums
4a210439f82441ee95802fa4a6efd1cec328bfd09d2e6ce6e098d55e479f975b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pysdl2_cffi-0.8.0-cp34-none-win_amd64.whl

Download URL pysdl2_cffi-0.8.0-cp34-none-win_amd64.whl
Size 291.4 kB
Tags CPython 3.4 Windows x86-64
SHA-256 checksum
How to use checksums
ffeb53feaa39d78afe0a7725a527c445d6cd838eb8c1cc83328c1526646450a7
BLAKE2b-256 checksum
How to use checksums
aa1b595ff058dc3592293f1d214f098ca36109c9415e842a8dd66b7a9bbedf31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pysdl2_cffi-0.8.0-cp34-none-win32.whl

Download URL pysdl2_cffi-0.8.0-cp34-none-win32.whl
Size 265.6 kB
Tags CPython 3.4 Windows x86-32
SHA-256 checksum
How to use checksums
ad735801167c153264e8d7b2823153fd965eded7410353bb50d8278fef0df153
BLAKE2b-256 checksum
How to use checksums
20bdcd3383242dbfd5a0bef2d3b3085e28472ed7d9a7522807be2920c3690547
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pysdl2_cffi-0.8.0-cp27-none-win_amd64.whl

Download URL pysdl2_cffi-0.8.0-cp27-none-win_amd64.whl
Size 291.5 kB
Tags CPython 2.7 Windows x86-64
SHA-256 checksum
How to use checksums
889087e77bd1efa78459e7fde7129c25f663a811080ca65fcbe6229ff4830cc8
BLAKE2b-256 checksum
How to use checksums
a1937ece4f92d52cf918db3038a846e46f83ae3e1733db3f1836839bcb275f13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pysdl2_cffi-0.8.0-cp27-none-win32.whl

Download URL pysdl2_cffi-0.8.0-cp27-none-win32.whl
Size 265.8 kB
Tags CPython 2.7 Windows x86-32
SHA-256 checksum
How to use checksums
4858dccb1092f5be585dd4e7a01abdbad95167403a4ba70309a965774b91c5be
BLAKE2b-256 checksum
How to use checksums
0dfff16e2cb47495781cbf7ff59fba7bb7ffbfefcef3712e2a6215d8938c1f44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.8.0 This release

5 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 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