Made a test version of fancy display for Screen.
This commit is contained in:
parent
c6299aaaa0
commit
8ac28a47f4
11
locate2.py
11
locate2.py
|
@ -28,16 +28,19 @@ class Screen:
|
|||
def fill(self, patern=" "):
|
||||
self._mat = [[patern[0] for i in range(self._width)] for i in range(self._height)]
|
||||
|
||||
def refresh(self, ask_for_input=True, endl="\n"):
|
||||
def refresh(self, ask_for_input=True, endl="\n", fancy=False):
|
||||
to_print = str()
|
||||
for line in self._mat:
|
||||
for line in self._mat[:-1] if fancy else self._mat:
|
||||
for cell in line:
|
||||
to_print += cell
|
||||
to_print += "\n"
|
||||
to_print = to_print[:-1]
|
||||
print(to_print)
|
||||
if ask_for_input:
|
||||
return input("> ")
|
||||
if ask_for_input or fancy:
|
||||
line = ""
|
||||
for cell in self._mat[-1][:-1]:
|
||||
line += cell
|
||||
return input(line if fancy else "> ")
|
||||
else:
|
||||
print("", end=endl)
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue