Add method writing to console

This commit is contained in:
Michał Czekański 2020-05-10 17:47:54 +02:00 committed by Marcin Kostrzewski
parent 7d71333558
commit 86394ef71b

View File

@ -32,6 +32,14 @@ class UiConsole(UiElement):
self.addLinesToConsole(["Hello from console!"]) self.addLinesToConsole(["Hello from console!"])
self.writeConsoleLines() self.writeConsoleLines()
# TODO: Should this method be static? We need to instantiate some console before we can write anything to it.
def writeToConsole(self, inp: str):
"""
Writes given string to console without scrolling to bottom.
:param inp: String to be written to console.
"""
self.addLinesToConsole([inp])
def writeConsoleLines(self, startingLineInd=0): def writeConsoleLines(self, startingLineInd=0):
self.image.fill(self.bgColor) self.image.fill(self.bgColor)
if startingLineInd < 0: if startingLineInd < 0: