Galaxie Shell 0.5.3 documentation


Navigation:   | Index   | Search   | Top   | Up   | Prev   | Next   |
Table of Content: |glxviewer.utils module |bracket_text() |center_text() |resize_text() |

© Copyright 2020-2024, Galaxie Viewer Team.

Top » glxviewer » glxviewer package » glxviewer.utils module

glxviewer.utils module

glxviewer.utils.bracket_text(text=None, symbol_inner='[', symbol_outer=']')[source]

Surround a text with an 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 (str) – 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 an in middle of the resize text

Returns:

a resize text

Return type:

str

Top » glxviewer » glxviewer package » glxviewer.utils module

© Copyright 2020-2024, Galaxie Viewer Team.
This page is licensed under the GNU General Public License v3 or later (GPLv3+).
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

Last updated on None.
Created using Sphinx 7.2.6.