diff --git a/arcade/gui/widgets/buttons.py b/arcade/gui/widgets/buttons.py index 2c339db9a9..c3588e4284 100644 --- a/arcade/gui/widgets/buttons.py +++ b/arcade/gui/widgets/buttons.py @@ -140,6 +140,12 @@ def __init__( bind(self, "_textures", self.trigger_render) + # prepare label with default style + _style = self.get_current_style() + if _style is None: + raise ValueError(f"No style found for state {self.get_current_state()}") + self._apply_style(_style) + def get_current_state(self) -> str: """Returns the current state of the button i.e.disabled, press, hover or normal.""" if self.disabled: @@ -330,6 +336,12 @@ def __init__( **kwargs, ) + # prepare label with default style + _style = self.get_current_style() + if _style is None: + raise ValueError(f"No style found for state {self.get_current_state()}") + self._apply_style(_style) + def get_current_state(self) -> str: """Returns the current state of the button i.e.disabled, press, hover or normal.""" if self.disabled: diff --git a/arcade/gui/widgets/text.py b/arcade/gui/widgets/text.py index e79b198140..16f8e932b5 100644 --- a/arcade/gui/widgets/text.py +++ b/arcade/gui/widgets/text.py @@ -273,6 +273,9 @@ def update_font( font_bold = bold if bold is not None else self._label.bold font_italic = italic if italic is not None else self._label.italic + # ensure type of font_color, label will allways be a color + font_color = Color.from_iterable(font_color) + # Check if values actually changed, if then update and trigger render font_name_changed = self._label.font_name != font_name font_size_changed = self._label.font_size != font_size