parent
d35e62b1d7
commit
80cf133bbf
12
locate2.py
12
locate2.py
|
@ -28,7 +28,7 @@ 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", fancy=False):
|
||||
def refresh(self, ask_for_input=True, endl="\n", fancy=False, fmargin=4):
|
||||
to_print = str()
|
||||
for line in self._mat[:-1] if fancy else self._mat:
|
||||
for cell in line:
|
||||
|
@ -38,9 +38,11 @@ class Screen:
|
|||
print(to_print)
|
||||
if ask_for_input or fancy:
|
||||
line = ""
|
||||
for cell in self._mat[-1][:-5]:
|
||||
if fancy:
|
||||
for cell in self._mat[-1][:-1-fmargin]:
|
||||
line += cell
|
||||
return input(line if fancy else "> ")
|
||||
return input(line)
|
||||
return input("> ")
|
||||
else:
|
||||
print("", end=endl)
|
||||
return None
|
||||
|
@ -70,7 +72,7 @@ class Screen:
|
|||
|
||||
class Pad(Screen):
|
||||
def refresh(self, x=1, y=1, width=21, height=7, ask_for_input=True,\
|
||||
endl="\n", fancy=True):
|
||||
endl="\n", fancy=True, fmargin=4):
|
||||
ogwidth = width
|
||||
if width > self._width:
|
||||
width = self._width
|
||||
|
@ -95,7 +97,7 @@ class Pad(Screen):
|
|||
to_print = to_print[:-1]
|
||||
print(to_print[:-width], end="")
|
||||
if ask_for_input or fancy:
|
||||
return input(to_print[-width:-1]+ " " * (ogwidth - width - 4) if fancy else "> ")
|
||||
return input(to_print[-width:-1]+ " " * (ogwidth - width - fmargin) if fancy else "> ")
|
||||
else:
|
||||
print(to_print[-width:], end=endl)
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue