Next: , Previous: , Up: Top   [Contents][Index]


4 Module inp

This chapter describes the contents of the inp module in detail.

4.1 nothing

This function does — just like the name says — nothing. It takes a arbitrary count of positional and keyword arguments and returns None.

4.2 InputHandler

The InputHandler waits for input and handles it as it arrives. It also controls wether the game runs in real-time or in turn-based mode. This might seem a little bit messed up at first. But it makes (a little bit) sense if you see that the difference between turn-based and real-time games only is wether you take input in blocking mode or not.

4.2.1 methods

Here are all methods of the InputHandler

4.2.1.1 __init__/constructor

The InputHandler takes at instanciation one argument. A float, int or bool that indicates wether the game should run in real-time or in turn-based mode. If it’s evaluates to False (e.g. it’s 0 or False), otherwise the given number is waited between the frames (in seconds). This means that you can’t pass True!

4.2.1.2 get_input

This method waits for input and processes it. Processing means that the input-event that was catched is lokked up in InputHandler.callbacks and calls the function returned by the lookup, with the input-event as first and only argument.

4.2.2 attributes

Here are all important attributes of the InputHandler listed.

4.2.2.1 screen

This variable holds the screen to get input from. It is None until the InputHandler is registered on a game.

4.2.2.2 blocking

This variable says wether input should be get in blocking or non blocking mode. See time-mode, for more on that. Don’t change this at run time!

4.3 key-constants

This module imports all the key-constants from curses. Please look at the python-curses documentation for their meaning.


Next: , Previous: , Up: Top   [Contents][Index]