GLXViewer.utils module¶
-
GLXViewer.utils.bracket_text(text=None, symbol_inner='[', symbol_outer=']')[source]¶ Surround a text with a inner and outer char.
Not you should center you text with center_text()before call it function
Parameters: - symbol_inner (str) – the symbol to use for as inner, generally that ‘[‘, ‘<’, ‘(‘
- symbol_outer (str) – the symbol to use for as outer, generally that ‘]’, ‘>’, ‘)’
- text (str) – the text it will be sur surround by the inner and outer chars
Returns: the text surrounded by inner and outer
Return type: str
-
GLXViewer.utils.center_text(text=None, max_width=None)[source]¶ Return a centred text from max_width, if max_width is None it will use the terminal width size.
example: center_text(text=”DLA”, max_width=5) return ” DLA “
Parameters: - text – text to center
- max_width (int) – the maximum width
Returns: the centred text
Return type: str
-
GLXViewer.utils.resize_text(text=None, max_width=0, separator='~')[source]¶ Resize the text , and return a new text
example: return ‘123~789’ for ‘123456789’ where max_width = 7 or 8
Parameters: - text (str) – the original text to resize
- max_width (int) – the size of the text
- separator (str) – a separator a in middle of the resize text
Returns: a resize text
Return type: str
