home

Documentation GConsole

Module import: from gconsole import *

Function Action
makeConsole() creates a (global) console window positioned at screen center with half the screen size
makeConsole(Position(ulx, uly), Size(width, height)) creates a (global) console window positioned at given (ulx, uly) with given size (width, height)
dispose() disposes the console window
isDisposed() returns True, if the console is disposed (by calling dispose() or hitting the close button)
clear() erases the content of the console window
hide() hides the console window
show() shows a hidden console window
setTitle(title) sets the windows title
showHorizontalScrollbar(enable) inserts a horizontal scroll bar
showVerticalScrollbar(enable) inserts a vertical scroll bar
delay(ms) stops the program for ms (milliseconds)
addExitListener(onExit) registers the callback function onExit() that is called when the close button is hit. dispose() must be called, to close the GPanel window


Writing

gprintln(v) writes a string or a number at current cursor position and sets the cursor at the beginning of the next line
gprint(v) writes a string or a number at current cursor position and sets the cursor at the end of the line



Reading

getFloat()   returns the <cr> terminated line as float; None, if the line cannot converted to a float
getInt()   returns the <cr> terminated line as integer; None, if the line cannot converted to an integer
getString() returns the <cr> terminated line
getKey() returns the character (as string) of the last key pressed (empty, if illegal key) (ord() also returns non-printing ASCII code)
getKeyWait() stops the program until a key is pressed and returns the character (as string) of the key (empty, if illegal key) (ord() also returns non-printing ASCII code)
getKeyCode() returns the code of the last key hit; returns 65535, if no key was hit
getKeyCodeWait() waits until a key is hit and returns its code
getModifiers() returns special code if ctrl/alt/shift key is pressed
getModifiersText() returns verbose description if ctrl/alt/shift key is pressed
kbhit() returns True, if a key hit is not yet fetched by calling getCodeCode()

home