mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Add type annotations for **options in tkinter.messagebox functions (#14341)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
@@ -11,4 +11,4 @@ class Dialog:
|
||||
# sometimes changed to a different type.
|
||||
options: Mapping[str, Any]
|
||||
def __init__(self, master: Misc | None = None, **options: Any) -> None: ...
|
||||
def show(self, **options: Any): ...
|
||||
def show(self, **options: Any) -> Any: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from tkinter import Misc
|
||||
from tkinter.commondialog import Dialog
|
||||
from typing import ClassVar, Final
|
||||
from typing import ClassVar, Final, Literal
|
||||
|
||||
__all__ = ["showinfo", "showwarning", "showerror", "askquestion", "askokcancel", "askyesno", "askyesnocancel", "askretrycancel"]
|
||||
|
||||
@@ -23,11 +24,75 @@ NO: Final = "no"
|
||||
class Message(Dialog):
|
||||
command: ClassVar[str]
|
||||
|
||||
def showinfo(title: str | None = None, message: str | None = None, **options) -> str: ...
|
||||
def showwarning(title: str | None = None, message: str | None = None, **options) -> str: ...
|
||||
def showerror(title: str | None = None, message: str | None = None, **options) -> str: ...
|
||||
def askquestion(title: str | None = None, message: str | None = None, **options) -> str: ...
|
||||
def askokcancel(title: str | None = None, message: str | None = None, **options) -> bool: ...
|
||||
def askyesno(title: str | None = None, message: str | None = None, **options) -> bool: ...
|
||||
def askyesnocancel(title: str | None = None, message: str | None = None, **options) -> bool | None: ...
|
||||
def askretrycancel(title: str | None = None, message: str | None = None, **options) -> bool: ...
|
||||
def showinfo(
|
||||
title: str | None = None,
|
||||
message: str | None = None,
|
||||
*,
|
||||
detail: str = ...,
|
||||
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||
default: Literal["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"] = ...,
|
||||
parent: Misc = ...,
|
||||
) -> str: ...
|
||||
def showerror(
|
||||
title: str | None = None,
|
||||
message: str | None = None,
|
||||
*,
|
||||
detail: str = ...,
|
||||
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||
default: Literal["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: ...
|
||||
|
||||
Reference in New Issue
Block a user