-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsgs_log.py
More file actions
30 lines (28 loc) · 878 Bytes
/
msgs_log.py
File metadata and controls
30 lines (28 loc) · 878 Bytes
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
def print_title(title, col=80):
title = " " + title + " "
length = len(title)
bounds = col - length
bounds = bounds / 2
bound_left = int(bounds)
bound_right = int(bounds) + 1 if not bounds.is_integer() else int(bounds)
print("="*col)
print("="*bound_left + title + "="*bound_right)
print("="*col)
print("")
def print_welcome(*args, col=80):
print("#"*col)
for arg in args:
print_welcome_body(arg, col)
print("#"*col)
print("")
def print_welcome_body(msg, col):
msg_arg = msg
msg = " " + msg + " "
if len(msg) > 78:
print_welcome_body(msg_arg[78:], col)
msg = msg[:78]
bounds = col - len(msg)
bounds = bounds / 2
bound_left = int(bounds)
bound_right = int(bounds) + 1 if not bounds.is_integer() else int(bounds)
print("#"*bound_left + msg + "#"*bound_right)