MCPcopy Create free account
hub / github.com/USBToolBox/tool / header

Function header

Scripts/utils.py:106–119  ·  view source on GitHub ↗
(text, width=55)

Source from the content-addressed store, hash-verified

104
105
106def header(text, width=55):
107 cls()
108 print(" {}".format("#" * width))
109 mid_len = int(round(width / 2 - len(text) / 2) - 2)
110 middle = " #{}{}{}#".format(" " * mid_len, text, " " * ((width - mid_len - len(text)) - 2))
111 if len(middle) > width + 1:
112 # Get the difference
113 di = len(middle) - width
114 # Add the padding for the ...#
115 di += 3
116 # Trim the string
117 middle = middle[:-di] + "...#"
118 print(middle)
119 print("#" * width)
120
121
122class TUIMenu:

Callers 2

headMethod · 0.85
startMethod · 0.85

Calls 1

clsFunction · 0.85

Tested by

no test coverage detected