85 lines
2.3 KiB
Python
85 lines
2.3 KiB
Python
from typing import Literal
|
|
from CTkMessagebox import CTkMessagebox
|
|
|
|
isHighDIP = False
|
|
|
|
class Message(CTkMessagebox):
|
|
def __init__(
|
|
self,
|
|
master: any = None,
|
|
width: int = 400,
|
|
height: int = 200,
|
|
title: str = "CTkMessagebox",
|
|
message: str = "This is a CTkMessagebox!",
|
|
option_1: str = "OK",
|
|
option_2: str = None,
|
|
option_3: str = None,
|
|
options: list = ...,
|
|
border_width: int = 1,
|
|
border_color: str = "default",
|
|
button_color: str = "default",
|
|
bg_color: str = "default",
|
|
fg_color: str = "default",
|
|
text_color: str = "default",
|
|
title_color: str = "default",
|
|
button_text_color: str = "default",
|
|
button_width: int = None,
|
|
button_height: int = None,
|
|
cancel_button_color: str = None,
|
|
cancel_button: str = None,
|
|
button_hover_color: str = "default",
|
|
icon: str = "info",
|
|
icon_size: tuple = None,
|
|
corner_radius: int = 15,
|
|
justify: str = "right",
|
|
font: tuple = None,
|
|
header: bool = False,
|
|
topmost: bool = True,
|
|
fade_in_duration: int = 0,
|
|
sound: bool = False,
|
|
wraplength: int = 0,
|
|
option_focus: Literal[1] | Literal[2] | Literal[3] = None,
|
|
isHighDPI: bool = False,
|
|
):
|
|
super().__init__(
|
|
master,
|
|
width,
|
|
height,
|
|
title,
|
|
message,
|
|
option_1,
|
|
option_2,
|
|
option_3,
|
|
options,
|
|
border_width,
|
|
border_color,
|
|
button_color,
|
|
bg_color,
|
|
fg_color,
|
|
text_color,
|
|
title_color,
|
|
button_text_color,
|
|
button_width,
|
|
button_height,
|
|
cancel_button_color,
|
|
cancel_button,
|
|
button_hover_color,
|
|
icon,
|
|
icon_size,
|
|
corner_radius,
|
|
justify,
|
|
font,
|
|
header,
|
|
topmost,
|
|
fade_in_duration,
|
|
sound,
|
|
wraplength,
|
|
option_focus,
|
|
)
|
|
if isHighDPI:
|
|
self._set_scaling(1.7, 1.7)
|
|
else:
|
|
self._set_scaling(1.1, 1.1)
|
|
|
|
def showError(message:str)->None:
|
|
Message(title="Error", message=message, icon="cancel", isHighDPI=isHighDIP) |