MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / button_color_to_tuple

Function button_color_to_tuple

PySimpleGUI/PySimpleGUI.py:14770–14791  ·  view source on GitHub ↗

Convert a color tuple or color string into 2 components and returns them as a tuple (Text Color, Button Background Color) If None is passed in as the first parameter, then the theme's button color is returned :param color_tuple_or_string: Button color - tuple or a simplied colo

(color_tuple_or_string, default=(None, None))

Source from the content-addressed store, hash-verified

14768##################################### ----- BUTTON Functions ------ ##################################################
14769
14770def button_color_to_tuple(color_tuple_or_string, default=(None, None)):
14771 """
14772 Convert a color tuple or color string into 2 components and returns them as a tuple
14773 (Text Color, Button Background Color)
14774 If None is passed in as the first parameter, then the theme's button color is
14775 returned
14776
14777 :param color_tuple_or_string: Button color - tuple or a simplied color string with word "on" between color
14778 :type color_tuple_or_string: str | (str, str)
14779 :param default: The 2 colors to use if there is a problem. Otherwise defaults to the theme's button color
14780 :type default: (str, str)
14781 :return: (str | (str, str)
14782 :rtype: str | (str, str)
14783 """
14784 if default == (None, None):
14785 color_tuple = _simplified_dual_color_to_tuple(color_tuple_or_string, default=theme_button_color())
14786 elif color_tuple_or_string == COLOR_SYSTEM_DEFAULT:
14787 color_tuple = (COLOR_SYSTEM_DEFAULT, COLOR_SYSTEM_DEFAULT)
14788 else:
14789 color_tuple = _simplified_dual_color_to_tuple(color_tuple_or_string, default=default)
14790
14791 return color_tuple
14792
14793
14794def _simplified_dual_color_to_tuple(color_tuple_or_string, default=(None, None)):

Callers 6

__init__Method · 0.85
updateMethod · 0.85
__init__Method · 0.85
updateMethod · 0.85
__init__Method · 0.85
theme_button_colorFunction · 0.85

Calls 2

theme_button_colorFunction · 0.85

Tested by

no test coverage detected