ok I've spent some time to port Matt_S patch to the latest 1.5.1 version (sorry for my lack of answers during those... 3 years... )
But I get the same error as jaunmakenro :
TypeError: string or integer address expected instead of str instance
Apparently, what worked with python 3 does not work anymore with 3.2+ because automatic conversion from str to bytes has been removed in version 3.2 (see
this).
The solution is to convert by hand all strings passed to libtcod to bytes, for example :
libtcod.console_init_root(80, 50, b'libtcod python sample', False)
instead of
libtcod.console_init_root(80, 50, 'libtcod python sample', False)
You can have another problem because python 3.2+ is more punctilious about types. You cannot pass a float where an int is expected. For example, this :
textColor = libtcod.console_get_char_background(sample_console, SAMPLE_SCREEN_WIDTH / 2, 5)
triggers this error :
TypeError: int expected instead of float
so you have to use python's integer division operator :
textColor = libtcod.console_get_char_background(sample_console, SAMPLE_SCREEN_WIDTH // 2, 5)
I've just commited a patch that make the samples works with both python 2.7.2 and 3.2.3. I can't assure everything works and I hope I didn't break things for python 2.7 users, but at least everything used in the samples work. I'm watching this topic now to avoid another 3 years of silence, so feel free to post issues/functions not working here.