diff --git a/terminal engine/tengine.py b/terminal engine/tengine.py new file mode 100644 index 0000000..799a05d --- /dev/null +++ b/terminal engine/tengine.py @@ -0,0 +1,22 @@ +from os import get_terminal_size + +class tengine(): + tx, ty = get_terminal_size().columns, get_terminal_size().lines + #feld = [[""]*10]*10 + feld = [["","","",],["","","",],["","","",]] + test = 0 + for a in feld: + for b in a: + print(test) + b = test + test +=1 + print(feld) + def strfeld(): + back = "" + for a in tengine.feld: + for b in a: + back += b + back += "\n" + return back + def addchar(character=str,position=list): + tengine.feld[2][2] = "a" diff --git a/terminal engine/test.py b/terminal engine/test.py new file mode 100644 index 0000000..ab94a1f --- /dev/null +++ b/terminal engine/test.py @@ -0,0 +1,15 @@ +#from tengine import tengine +#tengine.addchar("a",[5,5]) +#print(tengine.feld) + +feld = [["","","",],["","","",],["","","",]] +feld[1][1] = "a" +test = 0 +for a in feld: + for b in a: + print(test) + b = test + print(b) + test +=1 +feld[1][1] = "a" +print(feld) \ No newline at end of file diff --git a/v1.py b/v1.py index beaaed9..4387e88 100644 --- a/v1.py +++ b/v1.py @@ -3,27 +3,28 @@ import os from pynput import keyboard from time import sleep + def clear(): if os.name == "nt": os.system("cls") else: os.system("clear") + def on_press(key): global running if key == keyboard.Key.space: running = False - + def on_release(key): global running if key == keyboard.Key.esc: # Stop listener running = "finito" -listener = keyboard.Listener( - on_press=on_press, - on_release=on_release) + +listener = keyboard.Listener(on_press=on_press, on_release=on_release) listener.start() @@ -34,10 +35,10 @@ wobble_pos = 0 wobble_way = "right" running = True while running == True: - wobl = "-"*(tx-wobble_pos-5) - wobr = "-"*wobble_pos + wobl = "-" * (tx - wobble_pos - 5) + wobr = "-" * wobble_pos wobbl = f"{wobr}🐄️{wobl}" - print(" "*txhalb,"↓") + print(" " * txhalb, "↓") print(f"[{wobbl}]") print(wobble_pos) @@ -46,7 +47,7 @@ while running == True: else: wobble_pos -= 1 - if wobble_pos >= tx-1: + if wobble_pos >= tx - 1: wobble_way = "left" elif wobble_pos == 0: wobble_way = "right" @@ -65,10 +66,10 @@ else: if wobble_site == "right": points = wobble_pos else: - points = tx-wobble_pos + points = tx - wobble_pos -point_quote = points-tx/100 -for a in range(points*2): - print("-"*a+"🐄️",end="\r") +point_quote = points - tx / 100 +for a in range(points * 2): + print("-" * a + "🐄️", end="\r") sleep(0.01) -print("\n",point_quote,"%") \ No newline at end of file +print("\n", point_quote, "%")