Skip to content

Commit 9454ea5

Browse files
committed
bug fixes
1 parent 1aa5dfc commit 9454ea5

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

extras.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
import time
3+
from os import system, name
34

45
def decor(func):
56
def wrap():
@@ -20,4 +21,12 @@ def load_b():
2021
sys.stdout.write(i)
2122
sys.stdout.flush()
2223
time.sleep(0.3)
23-
print('\n')
24+
print('\n')
25+
26+
def clear():
27+
# Windows
28+
if name == 'nt':
29+
system('cls')
30+
# Mac and Linux
31+
else:
32+
system('clear')

option_validator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import time
2-
import os
32
import sys
4-
from extras import load_a, load_b
3+
from extras import load_a, load_b,clear
54
import caesar_encryption as ce
65
import caesar_decryption as cd
76

@@ -10,7 +9,7 @@ def options():
109
print()
1110
if option == '1':
1211
time.sleep(1.5)
13-
os.system('cls')
12+
clear()
1413
ce.intro()
1514
ce.note()
1615
print()
@@ -26,7 +25,7 @@ def options():
2625

2726
elif option == '2':
2827
time.sleep(1.5)
29-
os.system('cls')
28+
clear()
3029
cd.intro()
3130
cd.note()
3231
print()
@@ -42,7 +41,7 @@ def options():
4241

4342
elif option == '3':
4443
time.sleep(1.5)
45-
os.system('cls')
44+
clear()
4645
msg = "Thank you! :)\nSee you next time!"
4746
sys.exit(msg)
4847

redo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import time
22
from option_validator import options
3-
import os
3+
from extras import clear
44

55
def redo():
6-
os.system('cls')
6+
clear()
77
print('*******************************')
88
print('What would you like to do next?')
99
time.sleep(1)

0 commit comments

Comments
 (0)