From b82c63b0a544fc7c650d45906fc7f94195e5cb58 Mon Sep 17 00:00:00 2001 From: Isaac Benitez Date: Tue, 11 Oct 2022 22:57:43 -0700 Subject: [PATCH 1/2] Corrected typing to allow the color arguments to also take a Tuple --- adafruit_display_text/bitmap_label.py | 11 ++++++----- adafruit_display_text/label.py | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/adafruit_display_text/bitmap_label.py b/adafruit_display_text/bitmap_label.py index a37f940..3553e7d 100755 --- a/adafruit_display_text/bitmap_label.py +++ b/adafruit_display_text/bitmap_label.py @@ -55,8 +55,9 @@ class Label(LabelBase): Must include a capital M for measuring character size. :type font: ~FontProtocol :param str text: Text to display - :param int color: Color of all text in RGB hex - :param int background_color: Color of the background, use `None` for transparent + :param int|Tuple(int, int, int) color: Color of all text in HEX or RGB + :param int|Tuple(int, int, int) background_color: Color of the background, use `None` + for transparent :param float line_spacing: Line spacing of text to display :param bool background_tight: Set `True` only if you want background box to tightly surround text. When set to 'True' Padding parameters will be ignored. @@ -64,17 +65,17 @@ class Label(LabelBase): :param int padding_bottom: Additional pixels added to background bounding box at bottom :param int padding_left: Additional pixels added to background bounding box at left :param int padding_right: Additional pixels added to background bounding box at right - :param (float,float) anchor_point: Point that anchored_position moves relative to. + :param Tuple(float, float) anchor_point: Point that anchored_position moves relative to. Tuple with decimal percentage of width and height. (E.g. (0,0) is top left, (1.0, 0.5): is middle right.) - :param (int,int) anchored_position: Position relative to the anchor_point. Tuple + :param Tuple(int, int) anchored_position: Position relative to the anchor_point. Tuple containing x,y pixel coordinates. :param int scale: Integer value of the pixel scaling :param bool save_text: Set True to save the text string as a constant in the label structure. Set False to reduce memory use. :param bool base_alignment: when True allows to align text label to the baseline. This is helpful when two or more labels need to be aligned to the same baseline - :param (int,str) tab_replacement: tuple with tab character replace information. When + :param Tuple(int, str) tab_replacement: tuple with tab character replace information. When (4, " ") will indicate a tab replacement of 4 spaces, defaults to 4 spaces by tab character :param str label_direction: string defining the label text orientation. There are 5 diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index 360e7ba..a58b781 100755 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -48,8 +48,9 @@ class Label(LabelBase): Must include a capital M for measuring character size. :type font: ~FontProtocol :param str text: Text to display - :param int color: Color of all text in RGB hex - :param int background_color: Color of the background, use `None` for transparent + :param int|Tuple(int, int, int) color: Color of all text in HEX or RGB + :param int|Tuple(int, int, int) background_color: Color of the background, use `None` + for transparent :param float line_spacing: Line spacing of text to display :param bool background_tight: Set `True` only if you want background box to tightly surround text. When set to 'True' Padding parameters will be ignored. @@ -65,15 +66,15 @@ class Label(LabelBase): :param int padding_right: Additional pixels added to background bounding box at right. This parameter could be negative indicating additional pixels subtracted from the background bounding box. - :param (float,float) anchor_point: Point that anchored_position moves relative to. + :param Tuple(float, float) anchor_point: Point that anchored_position moves relative to. Tuple with decimal percentage of width and height. (E.g. (0,0) is top left, (1.0, 0.5): is middle right.) - :param (int,int) anchored_position: Position relative to the anchor_point. Tuple + :param Tuple(int, int) anchored_position: Position relative to the anchor_point. Tuple containing x,y pixel coordinates. :param int scale: Integer value of the pixel scaling :param bool base_alignment: when True allows to align text label to the baseline. This is helpful when two or more labels need to be aligned to the same baseline - :param (int,str) tab_replacement: tuple with tab character replace information. When + :param Tuple(int, str) tab_replacement: tuple with tab character replace information. When (4, " ") will indicate a tab replacement of 4 spaces, defaults to 4 spaces by tab character :param str label_direction: string defining the label text orientation. There are 5 From 2e0776937ff72f68757bfd8daffb6fd6d43cae4e Mon Sep 17 00:00:00 2001 From: Isaac Benitez Date: Thu, 13 Oct 2022 09:57:10 -0700 Subject: [PATCH 2/2] Updated background_color to also take None --- adafruit_display_text/bitmap_label.py | 2 +- adafruit_display_text/label.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_display_text/bitmap_label.py b/adafruit_display_text/bitmap_label.py index 3553e7d..a77c490 100755 --- a/adafruit_display_text/bitmap_label.py +++ b/adafruit_display_text/bitmap_label.py @@ -56,7 +56,7 @@ class Label(LabelBase): :type font: ~FontProtocol :param str text: Text to display :param int|Tuple(int, int, int) color: Color of all text in HEX or RGB - :param int|Tuple(int, int, int) background_color: Color of the background, use `None` + :param int|Tuple(int, int, int)|None background_color: Color of the background, use `None` for transparent :param float line_spacing: Line spacing of text to display :param bool background_tight: Set `True` only if you want background box to tightly diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index a58b781..8794af0 100755 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -49,7 +49,7 @@ class Label(LabelBase): :type font: ~FontProtocol :param str text: Text to display :param int|Tuple(int, int, int) color: Color of all text in HEX or RGB - :param int|Tuple(int, int, int) background_color: Color of the background, use `None` + :param int|Tuple(int, int, int)|None background_color: Color of the background, use `None` for transparent :param float line_spacing: Line spacing of text to display :param bool background_tight: Set `True` only if you want background box to tightly