add ascii.py

This commit is contained in:
Michael S. 2024-01-17 19:15:14 +01:00
parent fc97cb0c76
commit 1e5937a621
6 changed files with 11 additions and 18 deletions

Binary file not shown.

View file

@ -2,6 +2,9 @@
from os import get_terminal_size
tx,ty = get_terminal_size().columns ,get_terminal_size().lines-2
def clear():
print('\033c', end='')
class tengine():
def __init__(self) -> None:
self.screen = [[' ' for _ in range(tx)] for _ in range(ty+2)]
@ -24,7 +27,6 @@ class tengine():
back += line[:tx] + "\n"
return back.lstrip('\n').rstrip('\n')
def set_char(self, character, position):
self.screen[position[0]][position[1]] = character
@ -38,8 +40,7 @@ class tengine():
pposition = [pposition[0], pposition[1] + 1]
self.screen[pposition[0]][pposition[1]] = zeichen
def clear(self):
print('\033c', end='')
def draw_border(self, border_char='+'):
for i in range(len(self.screen)):

10
v1.py
View file

@ -1,17 +1,9 @@
#!/usr/bin/python3
import os
from forgejo.cowyeet_terminal.tengine.main import ty,tx,clear
from tengine.main import ty,tx,clear
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:

12
v2.py
View file

@ -44,7 +44,7 @@ if __name__ == "__main__" and running == True:
scene.set_block(ascii.start_screen_text,[ty,int(tx/2-5)])
scene.print()
sleep(0.2)
scene.clear()
clear()
if key_space == True:
while not key_space == False:
startscreen = False
@ -52,7 +52,7 @@ if __name__ == "__main__" and running == True:
scene.viereck([ty,int(tx/2-4)],11,1," ")
scene.print()
sleep(0.2)
scene.clear()
clear()
if key_space == True:
while not key_space == False:
startscreen = False
@ -62,7 +62,7 @@ if __name__ == "__main__" and running == True:
cows = "🐵🐒🦍🦧🐕🐯🦝🐩🐅🐴🐎🦄🦌🐗🐂🐃🐄🐪🐫🦙🦒🐹🦘🦡🐧🕊️ 🦅🦆🦉🐍🦎🐊🦜🦚🦩🐲🐉🦕"
cowlistlength = len(cows)
cow = "#" #cows[random.randint(0, cowlistlength - 1)]
scene.clear()
clear()
#scene[ty][tx] ### 2zeichen kuhh mach probleme
while running == True:
wobl = "-" * (tx - wobble_pos - 5)
@ -95,18 +95,18 @@ if __name__ == "__main__" and running == True:
wobble_way = "right"
sleep(wobble_speed)
scene.clear()
clear()
if key_space == True:
break
points_prozent = int((points/txhalb)*100)
scene.clear()
clear()
for a in range(int(points*2)-2):
scene.set_block("-"*a+cow,[0,0])#🐄️
scene.set_block(str(points_prozent)+"%",[1,int(tx/2-2)])
scene.print()
sleep(0.01)
scene.clear()
clear()
scene.print()
exit()