1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
from tkinter import Misc
from tkinter.commondialog import Dialog
from typing import ClassVar, Final, Literal
__all__ = ["showinfo", "showwarning", "showerror", "askquestion", "askokcancel", "askyesno", "askyesnocancel", "askretrycancel"]
ERROR: Final = "error"
INFO: Final = "info"
QUESTION: Final = "question"
WARNING: Final = "warning"
ABORTRETRYIGNORE: Final = "abortretryignore"
OK: Final = "ok"
OKCANCEL: Final = "okcancel"
RETRYCANCEL: Final = "retrycancel"
YESNO: Final = "yesno"
YESNOCANCEL: Final = "yesnocancel"
ABORT: Final = "abort"
RETRY: Final = "retry"
IGNORE: Final = "ignore"
CANCEL: Final = "cancel"
YES: Final = "yes"
NO: Final = "no"
class Message(Dialog):
command: ClassVar[str]
def showinfo(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["ok"] = "ok",
parent: Misc = ...,
) -> str: ...
def showwarning(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["ok"] = "ok",
parent: Misc = ...,
) -> str: ...
def showerror(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["ok"] = "ok",
parent: Misc = ...,
) -> str: ...
def askquestion(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["yes", "no"] = ...,
parent: Misc = ...,
) -> str: ...
def askokcancel(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["ok", "cancel"] = ...,
parent: Misc = ...,
) -> bool: ...
def askyesno(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["yes", "no"] = ...,
parent: Misc = ...,
) -> bool: ...
def askyesnocancel(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["cancel", "yes", "no"] = ...,
parent: Misc = ...,
) -> bool | None: ...
def askretrycancel(
title: str | None = None,
message: str | None = None,
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["retry", "cancel"] = ...,
parent: Misc = ...,
) -> bool: ...
|