|
40 | 40 |
|
41 | 41 | from micropython import const |
42 | 42 | import displayio |
43 | | -from adafruit_display_text.text_area import TextArea |
| 43 | +from adafruit_display_text.label import Label |
44 | 44 | from adafruit_display_shapes.rect import Rect |
45 | 45 | from adafruit_display_shapes.roundrect import RoundRect |
46 | 46 |
|
@@ -69,9 +69,9 @@ class Button(): |
69 | 69 | Defaults to RECT. |
70 | 70 | :param fill_color: The color to fill the button. Defaults to 0xFFFFFF. |
71 | 71 | :param outline_color: The color of the outline of the button. |
72 | | - :param label: The button label. Defaults to 0x0. |
| 72 | + :param label: The text that appears inside the button. Defaults to not displaying the label. |
73 | 73 | :param label_font: The button label font. |
74 | | - :param label_color: The color of the button label. Defaults to 0x0. |
| 74 | + :param label_color: The color of the button label text. Defaults to 0x0. |
75 | 75 | :param selected_fill: Inverts the fill color. |
76 | 76 | :param selected_outline: Inverts the outline color. |
77 | 77 | :param selected_label: Inverts the label color. |
@@ -138,7 +138,7 @@ def __init__(self, *, x, y, width, height, name=None, style=RECT, |
138 | 138 | dims = label_font.text_bounding_box(label) |
139 | 139 | if dims[2] >= width or dims[3] >= height: |
140 | 140 | raise RuntimeError("Button not large enough for label") |
141 | | - self.label = TextArea(label_font, text=label) |
| 141 | + self.label = Label(label_font, text=label) |
142 | 142 | self.label.x = x + (width - dims[2]) // 2 |
143 | 143 | self.label.y = y + (height - dims[3]) |
144 | 144 | self.label.color = label_color |
|
0 commit comments