Skip to content

Commit a6fc761

Browse files
committed
update
1 parent bc543c4 commit a6fc761

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

School_FinalOutput/Group1_Store.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@
33
from rich.table import Table
44
from rich.progress import track
55
from time import sleep
6+
import os
67

78
console = Console(width=100)
89

910

11+
def loadingScreen(text):
12+
for _ in track(range(10), description=f"[green]{text}"):
13+
sleep(0.2)
14+
15+
def Clearscreen():
16+
if os.name == "nt":
17+
os.system("cls")
18+
else:
19+
os.system("clear")
20+
1021

1122
# ========== Main Store | Where All the products are placed ==========
1223
class S_Store:
@@ -96,6 +107,7 @@ def buy(self):
96107
new_cust = Customer(cust_ID, cust_Name, cust_Address)
97108
for _ in track(range(10), description="[green]Adding Customer To Database"):
98109
sleep(0.2)
110+
Clearscreen()
99111
elif uInput == "N" or "n":
100112
self.buy()
101113
else:
@@ -124,7 +136,9 @@ def buy(self):
124136
sales_record += str(self.customer_choice) + " " + str(item_detail[0]) + " " + str(self.customer_quantity) + " "
125137
sales_record += str(self.customer_quantity * item_detail[1]) + " "
126138
sales_record += str(original_prod_Stock) + " " + str(current_number_of_Stock) + "\n"
127-
file_S_inventory.write(sales_record)
139+
file_S_inventory.write(sales_record)
140+
sleep(2)
141+
Clearscreen()
128142

129143

130144

@@ -190,6 +204,7 @@ def display_inventory(self):
190204

191205
# ========== First funtion to be called ==========
192206
def menu():
207+
Clearscreen()
193208
rpt = "Y"
194209

195210
while rpt == "Y":
@@ -213,6 +228,7 @@ def menu():
213228
S_Store.display_Shun_product(None)
214229

215230
elif c == 3: # Get specified customer record
231+
Clearscreen()
216232
first_customer.customer_record()
217233

218234
elif c == 4: #
@@ -223,6 +239,8 @@ def menu():
223239
prod_price = int(input("Product Price: "))
224240
prod_stock = int(input("Product Stock: "))
225241
new_prod = S_Store(prod_name, prod_price, prod_stock)
242+
loadingScreen("Adding Product")
243+
Clearscreen()
226244

227245
elif c == 6:
228246
cust_ID = int(input("Customer ID: "))
@@ -232,13 +250,14 @@ def menu():
232250
cust_Name.replace(" ", "_")
233251

234252
new_cust = Customer(cust_ID, cust_Name, cust_Address)
253+
loadingScreen("Adding Customer to the Database")
254+
Clearscreen()
235255

236256
elif c == 7:
237257
print("Thank You! Come Again.")
238258
rpt = "N"
239259
else:
240260
print("Enter the right number of choices!")
241-
for _ in track(range(10), description="[green]Restarting"):
242-
sleep(0.2)
261+
loadingScreen("Restarting")
243262
menu()
244263
menu()

0 commit comments

Comments
 (0)