From 86394ef71ba9d4b7a0da1e57ae7022f0c06e3e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Sun, 10 May 2020 17:47:54 +0200 Subject: [PATCH] Add method writing to console --- src/ui/UiConsole.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ui/UiConsole.py b/src/ui/UiConsole.py index 48ca682..8322088 100644 --- a/src/ui/UiConsole.py +++ b/src/ui/UiConsole.py @@ -32,6 +32,14 @@ class UiConsole(UiElement): self.addLinesToConsole(["Hello from console!"]) 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): self.image.fill(self.bgColor) if startingLineInd < 0: