About

This is a Python cffi port of libtcod.

This library is hosted on GitHub.

Any issues you have with this module can be reported at the GitHub issue tracker.

Usage

This module was designed to be backward compatible with the original libtcodpy module distributed with libtcod. If you had code that runs on libtcodpy then you can use this library as a drop-in replacement:

import tcod as libtcod

Guides and Tutorials for libtcodpy should work with the tcod module.

The latest documentation can be found here.

Installation

The recommended way to install is by using pip. Older versions of pip will have issues installing tdl, so make sure it’s up-to-date.

Windows / MacOS

To install using pip, use the following command:

> python -m pip install tdl

If you get the error “ImportError: DLL load failed: The specified module could not be found.” when trying to import tcod/tdl then you may need the latest Microsoft Visual C runtime.

Linux

The easiest method to install tdl on Linux would be from the PPA, this method will work for the Zesty, Artful, and Bionic versions of Ubuntu:

$ sudo add-apt-repository ppa:4b796c65/ppa
$ sudo apt-get update
$ sudo apt-get install python-tdl python3-tdl

Otherwise tdl will need to be built from source. Assuming you have Python, pip, and apt-get, then you’ll run these commands to install tdl and its dependencies to your user environment:

$ sudo apt-get install gcc python-dev python3-dev libsdl2-dev libffi-dev libomp5
$ pip2 install tdl
$ pip3 install tdl

Requirements

  • Python 2.7+, Python 3.4+, or PyPy 5.4+
  • Windows, Linux, or MacOS.
  • On Linux, requires libsdl2 and libomp5 to run.

License

python-tdl is distributed under the Simplified 2-clause FreeBSD license.