mirror of
https://github.com/KevinMidboe/tableprint.git
synced 2025-10-29 18:00:16 +00:00
Makes the message length the minimum width in banner()
This commit is contained in:
@@ -18,7 +18,7 @@ import sys
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
__all__ = ['table', 'header', 'row', 'hr', 'top', 'bottom', 'banner', 'dataframe', 'humantime']
|
__all__ = ['table', 'header', 'row', 'hr', 'top', 'bottom', 'banner', 'dataframe', 'humantime']
|
||||||
__version__ = '0.4.0'
|
__version__ = '0.4.1'
|
||||||
|
|
||||||
# set up table styles
|
# set up table styles
|
||||||
LineStyle = namedtuple('LineStyle', ('begin', 'hline', 'sep', 'end'))
|
LineStyle = namedtuple('LineStyle', ('begin', 'hline', 'sep', 'end'))
|
||||||
@@ -246,7 +246,7 @@ def banner(message, width=30, style='banner', out=sys.stdout):
|
|||||||
out : writer
|
out : writer
|
||||||
An object that has write() and flush() methods (Default: sys.stdout)
|
An object that has write() and flush() methods (Default: sys.stdout)
|
||||||
"""
|
"""
|
||||||
out.write(header([message], width, style) + '\n')
|
out.write(header([message], max(width, len(message)), style) + '\n')
|
||||||
out.flush()
|
out.flush()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user