Akascape / CTkMessagebox

A fully customizable messagebox for customtkinter! (extension/add-on)
Creative Commons Zero v1.0 Universal
319 stars 14 forks source link

Close button transparency #54

Closed P3rdigas closed 3 months ago

P3rdigas commented 7 months ago

I tried to implement this library in one of my applications, however when i try to set the transparency of the close button to transparent, to hide the button like in the documentation i get an error.

Code:

CTkMessagebox(
                title="Error",
                message="No template file selected!",
                icon="cancel",
                sound=True,
                option_focus=1,
                cancel_button=None,
                cancel_button_color="transparent",
            )

Error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Python312\Lib\tkinter\__init__.py", line 1967, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\Macbook\Documents\Projetos\AutoContract\.venv\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
    self._command()
  File "C:\Users\Macbook\Documents\Projetos\AutoContract\autocontract\app.py", line 854, in generate_contract
    CTkMessagebox(
  File "C:\Users\Macbook\Documents\Projetos\AutoContract\.venv\Lib\site-packages\CTkMessagebox\ctkmessagebox.py", line 216, in __init__
    self.button_close = customtkinter.CTkButton(self.frame_top, corner_radius=10, width=0, height=0, hover=False, border_width=0,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Macbook\Documents\Projetos\AutoContract\.venv\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 64, in __init__
    self._text_color: Union[str, Tuple[str, str]] = ThemeManager.theme["CTkButton"]["text_color"] if text_color is None else self._check_color_type(text_color)
                                                                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Macbook\Documents\Projetos\AutoContract\.venv\Lib\site-packages\customtkinter\windows\widgets\appearance_mode\appearance_mode_base_class.py", line 55, in _check_color_type
    raise ValueError(f"transparency is not allowed for this attribute")
ValueError: transparency is not allowed for this attribute
Akascape commented 3 months ago

fixed.