|
5 | 5 | """
|
6 | 6 | Display Text module helper functions
|
7 | 7 | """
|
8 |
| - |
9 | 8 | try:
|
10 | 9 | from typing import Tuple
|
11 | 10 | except ImportError:
|
@@ -180,9 +179,9 @@ class LabelBase(Group):
|
180 | 179 | :param int scale: Integer value of the pixel scaling
|
181 | 180 | :param bool save_text: Set True to save the text string as a constant in the
|
182 | 181 | label structure. Set False to reduce memory use.
|
183 |
| - :param: bool base_alignment: when True allows to align text label to the baseline. |
| 182 | + :param bool base_alignment: when True allows to align text label to the baseline. |
184 | 183 | This is helpful when two or more labels need to be aligned to the same baseline
|
185 |
| - :param: (int,str) tab_replacement: tuple with tab character replace information. When |
| 184 | + :param (int,str) tab_replacement: tuple with tab character replace information. When |
186 | 185 | (4, " ") will indicate a tab replacement of 4 spaces, defaults to 4 spaces by
|
187 | 186 | tab character"""
|
188 | 187 |
|
@@ -293,15 +292,13 @@ def background_color(self) -> int:
|
293 | 292 | """Color of the background as an RGB hex number."""
|
294 | 293 | return self._background_color
|
295 | 294 |
|
| 295 | + def _set_background_color(self, new_color): |
| 296 | + # subclasses should override this |
| 297 | + pass |
| 298 | + |
296 | 299 | @background_color.setter
|
297 | 300 | def background_color(self, new_color: int) -> None:
|
298 |
| - self._background_color = new_color |
299 |
| - if new_color is not None: |
300 |
| - self.palette[0] = new_color |
301 |
| - self.palette.make_opaque(0) |
302 |
| - else: |
303 |
| - self.palette[0] = 0 |
304 |
| - self.palette.make_transparent(0) |
| 301 | + self._set_background_color(new_color) |
305 | 302 |
|
306 | 303 | @property
|
307 | 304 | def anchor_point(self) -> Tuple[float, float]:
|
|
0 commit comments