(self, text = None, width = 55)
| 216 | |
| 217 | # Header drawing method |
| 218 | def head(self, text = None, width = 55): |
| 219 | if text == None: |
| 220 | text = self.name |
| 221 | self.cls() |
| 222 | print(" {}".format("#"*width)) |
| 223 | mid_len = int(round(width/2-len(text)/2)-2) |
| 224 | middle = " #{}{}{}#".format(" "*mid_len, text, " "*((width - mid_len - len(text))-2)) |
| 225 | if len(middle) > width+1: |
| 226 | # Get the difference |
| 227 | di = len(middle) - width |
| 228 | # Add the padding for the ...# |
| 229 | di += 3 |
| 230 | # Trim the string |
| 231 | middle = middle[:-di] + "...#" |
| 232 | print(middle) |
| 233 | print("#"*width) |
| 234 | |
| 235 | def resize(self, width, height): |
| 236 | print('\033[8;{};{}t'.format(height, width)) |
no test coverage detected