Skip to content

Commit 6cf9f3c

Browse files
authored
Merge pull request #176 from isacben/label-type-annotations-fix
Corrected typing to allow the color arguments to also take a Tuple
2 parents 41f06c3 + 2e07769 commit 6cf9f3c

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,27 @@ class Label(LabelBase):
5555
Must include a capital M for measuring character size.
5656
:type font: ~FontProtocol
5757
:param str text: Text to display
58-
:param int color: Color of all text in RGB hex
59-
:param int background_color: Color of the background, use `None` for transparent
58+
:param int|Tuple(int, int, int) color: Color of all text in HEX or RGB
59+
:param int|Tuple(int, int, int)|None background_color: Color of the background, use `None`
60+
for transparent
6061
:param float line_spacing: Line spacing of text to display
6162
:param bool background_tight: Set `True` only if you want background box to tightly
6263
surround text. When set to 'True' Padding parameters will be ignored.
6364
:param int padding_top: Additional pixels added to background bounding box at top
6465
:param int padding_bottom: Additional pixels added to background bounding box at bottom
6566
:param int padding_left: Additional pixels added to background bounding box at left
6667
:param int padding_right: Additional pixels added to background bounding box at right
67-
:param (float,float) anchor_point: Point that anchored_position moves relative to.
68+
:param Tuple(float, float) anchor_point: Point that anchored_position moves relative to.
6869
Tuple with decimal percentage of width and height.
6970
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)
70-
:param (int,int) anchored_position: Position relative to the anchor_point. Tuple
71+
:param Tuple(int, int) anchored_position: Position relative to the anchor_point. Tuple
7172
containing x,y pixel coordinates.
7273
:param int scale: Integer value of the pixel scaling
7374
:param bool save_text: Set True to save the text string as a constant in the
7475
label structure. Set False to reduce memory use.
7576
:param bool base_alignment: when True allows to align text label to the baseline.
7677
This is helpful when two or more labels need to be aligned to the same baseline
77-
:param (int,str) tab_replacement: tuple with tab character replace information. When
78+
:param Tuple(int, str) tab_replacement: tuple with tab character replace information. When
7879
(4, " ") will indicate a tab replacement of 4 spaces, defaults to 4 spaces by
7980
tab character
8081
:param str label_direction: string defining the label text orientation. There are 5

adafruit_display_text/label.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ class Label(LabelBase):
4848
Must include a capital M for measuring character size.
4949
:type font: ~FontProtocol
5050
:param str text: Text to display
51-
:param int color: Color of all text in RGB hex
52-
:param int background_color: Color of the background, use `None` for transparent
51+
:param int|Tuple(int, int, int) color: Color of all text in HEX or RGB
52+
:param int|Tuple(int, int, int)|None background_color: Color of the background, use `None`
53+
for transparent
5354
:param float line_spacing: Line spacing of text to display
5455
:param bool background_tight: Set `True` only if you want background box to tightly
5556
surround text. When set to 'True' Padding parameters will be ignored.
@@ -65,15 +66,15 @@ class Label(LabelBase):
6566
:param int padding_right: Additional pixels added to background bounding box at right.
6667
This parameter could be negative indicating additional pixels subtracted from the
6768
background bounding box.
68-
:param (float,float) anchor_point: Point that anchored_position moves relative to.
69+
:param Tuple(float, float) anchor_point: Point that anchored_position moves relative to.
6970
Tuple with decimal percentage of width and height.
7071
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)
71-
:param (int,int) anchored_position: Position relative to the anchor_point. Tuple
72+
:param Tuple(int, int) anchored_position: Position relative to the anchor_point. Tuple
7273
containing x,y pixel coordinates.
7374
:param int scale: Integer value of the pixel scaling
7475
:param bool base_alignment: when True allows to align text label to the baseline.
7576
This is helpful when two or more labels need to be aligned to the same baseline
76-
:param (int,str) tab_replacement: tuple with tab character replace information. When
77+
:param Tuple(int, str) tab_replacement: tuple with tab character replace information. When
7778
(4, " ") will indicate a tab replacement of 4 spaces, defaults to 4 spaces by
7879
tab character
7980
:param str label_direction: string defining the label text orientation. There are 5

0 commit comments

Comments
 (0)