neuer commit 21:40

This commit is contained in:
Désiré Werner Menrath 2023-03-28 21:40:25 +02:00
parent 12ccfb0a36
commit 035e3e9df2

33
main.py
View File

@ -1,17 +1,31 @@
#!/usr/bin/python3
import random
import os
from os import system, name
from subprocess import call
import sys
import termios
import tty
import keyboard
from colorama import Fore, Back, Style
cube_ = 'Würfel-Generator\n'
cube = 'Würfel-Generator\n'
print(cube.center(54))
def cube():
while True:
try:
entry = int(input('1 drücken zum Würfeln.\n2 drücken zum beenden.\n'))
entry = 99
while entry != 2:
try:
print('\x1b[H\x1b[1;20H ', cube_)
entry = int(input('\x1b[H\x1b[B\x1b[B1 drücken zum Würfeln.\n2 drücken zum beenden.'))
print('\n')
if entry == 1:
os.system("clear")
print(random.randint(1, 6))
system('clear')
#print(Fore.RED)
print('\x1b[10;20HDu hast eine \x1b[1;33m%d\x1b[1;0m gewürfelt' %random.randint(1, 6))
#print("123 %d hajsishib" %random.randint(1, 6))
elif entry == 0:
print('Ups! Da wurde nicht 1 oder 2 gedrückt. Bitte nochmal versuchen.\n')
elif entry == 2:
@ -21,6 +35,9 @@ def cube():
print('Ups! Da wurde nicht 1 oder 2 gedrückt. Bitte nochmal versuchen.\n')
except ValueError:
print('Ups! Da wurde nicht 1 oder 2 gedrückt. Bitte nochmal versuchen.\n')
print("entry =", entry)
cube()