-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrontend.py
65 lines (56 loc) · 3.05 KB
/
frontend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from backend import *
import os
from colorama import Fore, Style, init
# starter colorama
init(autoreset=True)
# gjør skjermen klar og clean
def clear_screen():
os.system('cls' if os.name == 'nt' else 'clear')
# legger til colorama for at de skal se bra ut
def printMeny():
clear_screen()
# Menu top
print(Fore.CYAN + Style.BRIGHT + "╔═══════════════════════════════════════════════════╗")
print(Fore.CYAN + Style.BRIGHT + "║" + Fore.YELLOW + " 🌟 Kalkulator 🌟 " + Fore.CYAN + "║")
print(Fore.CYAN + "╚═══════════════════════════════════════════════════╝")
# Meny
print(Fore.CYAN + "╔═══════════════════════════════════════════════════╗")
print(Fore.CYAN + "║" + Fore.GREEN + " 1. ➕ Legg sammen (pluss) " + Fore.CYAN + "║")
print(Fore.CYAN + "║" + Fore.GREEN + " 2. ➖ Trekk fra (minus) " + Fore.CYAN + "║")
print(Fore.CYAN + "║" + Fore.GREEN + " 3. ✖️ Gange " + Fore.CYAN + "║")
print(Fore.CYAN + "║" + Fore.GREEN + " 4. ➗ Dele " + Fore.CYAN + "║")
print(Fore.CYAN + "║" + Fore.RED + " 5. ❌ Avslutt " + Fore.CYAN + "║")
print(Fore.CYAN + "╚═══════════════════════════════════════════════════╝")
# Input
menyvalg = input(Fore.YELLOW + "✨ Velg hva du vil regne med som du ikke kan bruke det lille hjernen din til jævla firkantfjes (1-5): " + Fore.RESET)
utfoerMenyvalg(menyvalg)
# følger brukerens input
def utfoerMenyvalg(valgtTall):
if valgtTall == "1":
leggSammen()
pause_og_fortsett()
elif valgtTall == "2":
trekkFra()
pause_og_fortsett()
elif valgtTall == "3":
gange()
pause_og_fortsett()
elif valgtTall == "4":
dele()
pause_og_fortsett()
elif valgtTall == "5":
bekreftelse = input(Fore.RED + "❓Vil du avslutte brur? J/N: " + Fore.RESET)
if bekreftelse.lower() == "j":
print(Fore.MAGENTA + "OK, fuck off da, det er ikke noa galt i å være en liten bitch" + Fore.RESET)
exit()
else:
printMeny()
else:
nyttForsoek = input(Fore.RED + "*** Ugyldig valg din dumme faen. Velg et tall mellom 1-5 og faenmeg gjør det, dette er ikke rakettforskning. Trykk for å fortsette *** " + Fore.RESET)
printMeny()
# pauser og returnerer til menyen
def pause_og_fortsett():
input(Fore.CYAN + "🔄 Trykk en tast for å fortsette. eller ikke. ditt valg, ikke mitt..." + Fore.RESET)
printMeny()
# viser menyen
printMeny()