cowyeet_terminal/terminal engine/tengine.py

43 lines
992 B
Python
Raw Normal View History

2023-11-06 16:13:41 +01:00
from os import get_terminal_size
2023-11-06 20:13:12 +01:00
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):
2023-11-06 16:13:41 +01:00
test = 0
2023-11-06 20:13:12 +01:00
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 = ""
2023-11-06 16:13:41 +01:00
for a in feld:
for b in a:
2023-11-06 20:13:12 +01:00
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