Forums

Installing Libtcod and other libraries

So I'm working on a project for school and Pythonanywhere is what my teacher has directed us to use to compile all of our code. The final project we're doing is to make a small game. So I was going to make a small roguelike-ish game as I've been interested in them lately. So I was following a tutorial andit requires the use of Libtcod. Thus is where my issue lies because Libtcod is not on the list of "Batteries Included". How can I make install it for use on PythonAnywhere?

Hey rholtson,

As it happens I was just looking at libtcod the other day. The problem is that it requires a GUI, it's not a pure-terminal library. PythonAnywhere doesn't have a display, so it won't work...

You could try building a roguelike using the console only - ncurses is available, and you could look at someone else's example, like PyRogue, but it might be more work!

I'm ready for the challenge. Thanks for the help.

How do I call up ncurses in the PythonAnywhere interpreter

Hi rholston, have you had a look at the documentation for curses?

A very basic curses application example is below. It will just echo what you are typing to the screen:

import curses

def echo_input(stdscr):
    while True:
        c = stdscr.getch()
        stdscr.addstr(chr(c))

if __name__ == '__main__':
    curses.wrapper(echo_input)

Ah thank you for the link to the documentation. As many times as I've consulted that tutorial I can't believe I didn't check their first for help. Also might I add how helpful the community is here. I'm incredibly grateful for the assistance I'm getting!