-
Notifications
You must be signed in to change notification settings - Fork 13
/
User_Interface.py
40 lines (36 loc) · 1.16 KB
/
User_Interface.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
# 5. модуль User_Interface
# функция
# def user_choice
# Обращается к пользователю для выбора режима
# 1) Вывод всей инф
# 2) Вывод всех ДР
# 3) Вывод успеваемости
# 4) Вывод пола
# Возвращает выбор пользователя
from os import system
system('cls')
from colorama import init
init()
from colorama import Fore, Back, Style
def user_choice():
while True:
print(Style.RESET_ALL)
user_input = input('''
1 - вывод ID, 2 - вывод ФИО
3 - вывод ДР, 4 - вывод успеваемости
5 - вывод пола, 6 - вывод всех данных
0 - выход\n
Выберите действие: ''')
try:
user_input = int(user_input)
except:
print(Fore.RED + '''
Введите номер цифрой!''')
continue
if user_input >= 0 and user_input <= 6:
return user_input
else:
print(Fore.RED + '''
Выбрать нужно от 0 до 6!''')
if __name__ == '__main__':
user_choice()