The console module

The console module provides the ability to retrieve input from the user through the console.

The ConsoleInput class

Inheritance diagram of pyamp.ui.input.console.ConsoleInput

class pyamp.ui.input.console.ConsoleInput(callback, conditionFn=<function <lambda> at 0xa506df4>, exceptionFn=None, logger=None)[source]

The ConsoleInput class provides the ability to receive input from a user through the console. This class runs as a separate thread which monitors the console for input and notifies a callback method in the event that keyboard input is received.

The callback method must take one argument which is the character that was read as input. This class also provides the ability to register a callback function to be called in the event that an exception occurs during the processing of the thread.

This class implements the pyamp.processes.Thread, and the amp.logging.Loggable interfaces.

  • callback – The function called when input is received

  • conditionFn – The function used to determine whether we should

    continue waiting for input

  • exceptionFn – The functionc called when an exception is encountered

  • logger – The logger object

classmethod clearScreen()[source]

Clear the console screen.

classmethod getCols()[source]

Get the number of columns for this console screen.

classmethod getRows()[source]

Get the number of rows for this console screen.

classmethod getSize()[source]

Get the size of the current console screen.

onCycle(_increment)[source]

Called during each cycle of the Thread.

  • increment – The current increment number
onException(e, traceback)[source]

This function is called in the event that an exception occurs during the processing of the thread.

  • e – The exception
  • traceback – The traceback
onShutdown()[source]

Called when the ConsoleInput Thread is shutdown.

onStart()[source]

Called when the ConsoleInput thread is started.

Table Of Contents

Previous topic

The keys module

Next topic

The evdev module

This Page