42 lines
992 B
Python
42 lines
992 B
Python
from os import get_terminal_size
|
|
|
|
tx = get_terminal_size().columns
|
|
ty = get_terminal_size().lines
|
|
def genfeld():
|
|
feld = [[' ' for _ in range(tx)] for _ in range(ty)]
|
|
return feld
|
|
def bg_char(feld,char=str):
|
|
test = 0
|
|
for a in range(len(feld)):
|
|
for b in range(len(feld[0])):
|
|
feld[a][b] = test
|
|
test = char
|
|
return feld
|
|
|
|
def strfeld(feld):
|
|
back = ""
|
|
for a in feld:
|
|
for b in a:
|
|
back += str(b)
|
|
back += "\n"
|
|
return back
|
|
|
|
def change_char(feld,character=str,position=list):
|
|
feld[position[0]][position[1]] = character
|
|
def change_block(feld,string=str,position=list):
|
|
a = ""
|
|
block_len = 0
|
|
for a in string:
|
|
if a == "\n":
|
|
break
|
|
else:
|
|
block_len += 1
|
|
print(block_len)
|
|
for zeichen in string:
|
|
feld[position[0]][position[1]] = zeichen
|
|
position[0] += 1
|
|
if position[0]== block_len-1:
|
|
position[0] = 0
|
|
return feld
|
|
|
|
|