forked from dizir7772/AssistBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessagebox.py
More file actions
47 lines (38 loc) · 1.44 KB
/
messagebox.py
File metadata and controls
47 lines (38 loc) · 1.44 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
from console import *
import colorama
from screen import Screen
from colorama import Fore, Back, Style
colorama.init(autoreset=True)
"""
|------------------------------------------|
| SOME TEXT |
|------------------------------------------|
| |
| |
| |
| |
| Some text.... |
| Some text.... |
| |
| |
| |
| |
|------------------------------------------|
| STATUS |
|------------------------------------------|
"""
class Messagebox:
""" Просто виводить текст на екран """
def __init__(self, screen: Screen, msg: str) -> None:
self._screen = screen
self._msg = msg
def draw(self):
self._screen.draw()
strings = self._msg.split('\n')
max_str_len = max((len(s) for s in strings))
str_qty = len(strings)
row_start = gap(self._screen.h, str_qty)
col_start = gap(self._screen.w, max_str_len)
for i in range(str_qty):
move_cursor(row_start+i, col_start)
print(Fore.YELLOW+strings[i], end='')