From 5767aeafed12f13fd974e4772fa6990264eb7c28 Mon Sep 17 00:00:00 2001 From: llgdd <53429650+llgdd@users.noreply.github.com> Date: Mon, 28 Dec 2020 03:36:50 +0200 Subject: [PATCH 1/2] Added width, justify --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 3be65a6..706ae61 100755 --- a/main.py +++ b/main.py @@ -9,6 +9,8 @@ # VARIABLES padding = [1, 0, 0, 3] +width = os.get_terminal_size().columns +justify = 'center' font_name = '3x5' custom_char_replace = {'#': '\u2588'} time_format = '%H:%M:%S' @@ -22,7 +24,7 @@ time_string = datetime.datetime.now().strftime(time_format) # Turn the string into a figlet ASCII art string - figlet_string = figlet_format(time_string, font=font_name) + figlet_string = figlet_format(time_string, font=font_name, width=width, justify=justify) # Replace any characters for char in custom_char_replace: From 26932ecad585e3bf507937d8a0203639dce96570 Mon Sep 17 00:00:00 2001 From: llgdd <53429650+llgdd@users.noreply.github.com> Date: Mon, 28 Dec 2020 03:42:49 +0200 Subject: [PATCH 2/2] Updated README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c5c99f..ae9ef79 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,10 @@ The variables at the start of the script can all be changed to modify the look a | Variable | Default | Description | Useful Link(s) | |--------------------- |-------------------------- |-------------------------------------------------------------------------------- |------------------------------------------------------ | -| font_name | ``` '3x5' ``` | Changes the Figlet font which is rendered | [Figlet Font DB](http://www.figlet.org/fontdb.cgi) | +| font_name | ``` '3x5' ``` | Changes the Figlet font which is rendered | [Figlet Font DB](http://www.figlet.org/fontdb.cgi) | | padding | ``` [0, 0, 0, 0] ``` | Applies padding to the top/right/bottom/left of the text | | +| width | terminal width | Defines the width for ```justify``` to work. By default is equal to terminal's width | | +| justify | ``` 'center' ``` | Justify the output ('auto', 'left', 'center', 'right') | | | custom_char_replace | ``` {'#': '\u2588'} ``` | Used to replace the character(s) in the key with the character(s) in the value | [Unicode Character Table](https://unicode-table.com) | | time_format | ``` '%H:%M:%S' ``` | Set the format of the time to be displayed | [Time Formatting Parameters](http://strftime.org/) |