format_display_message()

audeer.format_display_message(text, pbar=False)[source]

Ensure a fixed length of text printed to screen.

The length of the text message is the same as the overall progress bar length as given by audeer.config.TQDM_COLUMNS.

Parameters
  • text (str) – text to be displayed

  • pbar (bool) – if a progress bar is displayed as well. This will shorten the text to the given progress bar description length audeer.config.TQDM_DESCLEN

Return type

str

Returns

formatted text message

Examples

>>> config.TQDM_COLUMNS = 20
>>> format_display_message("Long text that will be shorten to fit")
'Long te...n to fit'