Skip to main content

Simple DirectMedia Layer

Project description

pycsdl2 is a low-overhead, compiled SDL2 binding for CPython. It aims to provide the familiar C API of SDL2, while offering several Pythonic features such as automatic memory management, bounds checking and exceptions.

Documentation

Documentation is hosted online at https://pycsdl2.readthedocs.org/.

The Python API is documented with Sphinx in the docs/ directory. If you have GNU Make and Sphinx installed, run the following in the docs/ directory to generate the HTML documentation in docs/_build/html/:

make html

On Windows, make.bat can be used instead of GNU Make. Run the following in the docs/ directory to generate the HTML documentation in docs/_build/html/:

.\make.bat html

The documentation can be generated in other formats as well. See the output of make help or .\make.bat help for more details.

Building

Building the source code requires the CPython header files to be installed. This may require the installation of a development package such as python3-dev in Debian. The headers are installed by default in the official Python distributions for Windows and Mac OS X.

On Windows and Mac OS X, pycsdl2 will be statically linked against the bundled SDL2 source code. As such,

On other platforms such as Linux, the system must have a C compiler installed and the SDL2 library and header files installed. This may require the installation of a development package such as libsdl2-dev on Debian. Furthermore, a working installation of sdl2-config or pkg-config must be present in the executable search paths. pycsdl2 will be dynamically linked to the SDL2 library on these platforms.

Once your system satisfies the above requirements, run the following in the root of the source directory:

python3 setup.py build

If the build is successful, pycsdl2 can be installed with:

python3 setup.py install

The above build behavior can be controlled with the environment variable PYCSDL2_LIB:

  • setting it to auto will use the default behavior. setup.py will build and link against the bundled SDL2 source code on Windows and Mac OS X, and link against the system SDL2 library on other platforms.

  • setting it to bundled will force setup.py to build and link against the bundled SDL2 source code.

  • setting it to system will force setup.py to link against the system’s SDL2 library. sdl2-config will be used to retrieve the required compile and link flags, and if it fails, pkg-config will be used instead.

  • setting it to sdl2-config or pkg-config will force setup.py to link against the system’s SDL2 library, and to only use sdl2-config or pkg-config respectively to retrieve the required compile and link flags.

Unit tests

Unit tests are implemented using the unittest standard library module. Once the pycsdl2 has been built with python3 setup.py build, you can run all tests by running the following in the root of the source directory:

python3 -mtest

You can also run an individual test suite by running the corresponding file in the test/ directory:

python3 test/testfoo.py

Understanding the source code

The source code is documented with Doxygen. If you have a working installation, simply run the following in the root of the source directory:

doxygen

The HTML documentation will be written to the apidocs/html directory.

License

Unless otherwise stated, pycsdl2 source code is licensed under the zlib license.

pycsdl2 source code contains an unmodified copy of the Simple DirectMedia Layer (SDL) version 2.0.0 source code. The source code is licensed under the zlib license.

Download files

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

Source Distribution

pycsdl2-2.0.0.0.dev1.tar.bz2 (3.2 MB view details)

Uploaded Source

Built Distributions

pycsdl2-2.0.0.0.dev1-cp34-none-win_amd64.whl (655.0 kB view details)

Uploaded CPython 3.4 Windows x86-64

pycsdl2-2.0.0.0.dev1-cp34-none-win32.whl (598.2 kB view details)

Uploaded CPython 3.4 Windows x86

pycsdl2-2.0.0.0.dev1-cp34-cp34m-macosx_10_6_intel.whl (1.1 MB view details)

Uploaded CPython 3.4m macOS 10.6+ intel

File details

Details for the file pycsdl2-2.0.0.0.dev1.tar.bz2.

File metadata

File hashes

Hashes for pycsdl2-2.0.0.0.dev1.tar.bz2
Algorithm Hash digest
SHA256 a45758be4d0ffd09aeda352f930fca3c2b150368a8b3f317d568125ea5dc6575
MD5 4622b3129691968b007203aa7559279a
BLAKE2b-256 27fadb8efe58373fbac198b9d1a8a6502722a8698dab703c1cb4a780a08a263a

See more details on using hashes here.

File details

Details for the file pycsdl2-2.0.0.0.dev1-cp34-none-win_amd64.whl.

File metadata

File hashes

Hashes for pycsdl2-2.0.0.0.dev1-cp34-none-win_amd64.whl
Algorithm Hash digest
SHA256 f62c28d0a7c1c1a1f0eb66583f2bba8355656c068164f4f73dc7e458428f557a
MD5 2dbe874116b47cb3d550db9c827eb9ae
BLAKE2b-256 0f79f06b1523a42330e798fe986b5f7eea915cd212e0788d0e6873b1814b7d1f

See more details on using hashes here.

File details

Details for the file pycsdl2-2.0.0.0.dev1-cp34-none-win32.whl.

File metadata

File hashes

Hashes for pycsdl2-2.0.0.0.dev1-cp34-none-win32.whl
Algorithm Hash digest
SHA256 07709715a515a2455e35a21ef7398386b6f132f6966c8d5ef73e130a2b9c8ede
MD5 11c6df2a350eb92db14306d0c4ebdd91
BLAKE2b-256 37c738d84a3f6cae580c4079061dc6228f33c6ad12a76873b4554389d0890740

See more details on using hashes here.

File details

Details for the file pycsdl2-2.0.0.0.dev1-cp34-cp34m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for pycsdl2-2.0.0.0.dev1-cp34-cp34m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 6dab2820aa9a1a980451f00f565dcd50ec9831fcc83abefbef717f9f6950b266
MD5 9fbdd255a7f9fdf8f138e306586d5d95
BLAKE2b-256 b45dfb4ed323539a4595f73a55d039b47a88382760b8b0233e801679b0d26d53

See more details on using hashes here.

Supported by

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