-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscreen.py
More file actions
63 lines (49 loc) · 1.83 KB
/
screen.py
File metadata and controls
63 lines (49 loc) · 1.83 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
58
59
60
61
62
from console import *
import colorama
from colorama import Fore, Back, Style
colorama.init(autoreset=True)
"""
|------------------------------------------|
| TITLE |
|------------------------------------------|
| |
| |
| |
| |
| |
| |
| |
|------------------------------------------|
| STATUS |
|------------------------------------------|
"""
class Screen:
""" Клас що описує сутність екран """
def __init__(self, title: str, status: str) -> None:
self.title = title.upper()
self.status = status.upper()
self.h, self.w = get_console_size()
@property
def title(self):
return self._title
@title.setter
def title(self,value):
self._title = value
@property
def status(self, value):
return self._status
@status.setter
def status(self,value):
self._status = value
def draw(self):
self.h, self.w = get_console_size()
clear_console()
move_cursor(0, 0)
print(Fore.GREEN+'|' + '-'*(self.w-2) + '|')
print(Fore.GREEN+'|' + Fore.RED + self._title.center(self.w-2) + Fore.GREEN + '|')
print(f'{Fore.GREEN}'+'|' + '-'*(self.w-2) + '|')
for i in range(self.h-6-1):
print(f'{Fore.GREEN}'+'|'+' '*(self.w-2)+'|')
print(f'{Fore.GREEN}'+'|' + '-'*(self.w-2) + '|')
print(Fore.GREEN+'|' + Fore.RED + self._status.center(self.w-2) + Fore.GREEN + '|')
print(f'{Fore.GREEN}'+'|' + '-'*(self.w-2) + '|')