-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_utils.py
More file actions
57 lines (48 loc) · 1.66 KB
/
my_utils.py
File metadata and controls
57 lines (48 loc) · 1.66 KB
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
import os, time
from typing import Callable
def clean_console() -> None:
os.system("cls" if os.name == "nt" else "clear")
def function_frame(func: Callable) -> Callable:
def wrapper(*args, **kwargs):
print("""
╔════════════════════════════════╗
""")
func(*args, **kwargs)
print("""
╚════════════════════════════════╝
""")
return wrapper
def frame(text: str) -> None:
print(f"""
╔════════════════════════════════╗
{text}
╚════════════════════════════════╝""")
@function_frame
def show_menu() -> None:
menu = """ Commands:
1. Ver catálogo
2. Agregar producto al carrito
3. Eliminar producto del carrito
4. Vaciar carrito
5. Mostrar carrito
6. Finalizar compra
7. Salir"""
print(menu)
@function_frame
def welcome_message() -> None:
print(""" 🏪✨ Welcome to Market""")
@function_frame
def goodbye_message() -> None:
print("""
✨ Thank you for visiting!✨
We truly appreciate your time
and trust. Your presence means
a lot to us.
🛍️ We hope you found exactly
what you were looking for! 🛒
""")
def counter_to_zero_from(seconds: int) -> None:
for remain_seconds in range(seconds, 0, -1):
print(f" Restarting in {remain_seconds}")
time.sleep(1)
clean_console()