Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,7 @@
from tkinter.commondialog import Dialog
from typing import Any, ClassVar, Optional, Tuple, Union
from typing import Any, ClassVar, Tuple
class Chooser(Dialog):
command: ClassVar[str]
def askcolor(
color: Optional[Union[str, bytes]] = ..., **options: Any
) -> Union[Tuple[None, None], Tuple[Tuple[float, float, float], str]]: ...
def askcolor(color: str | bytes | None = ..., **options: Any) -> Tuple[None, None] | Tuple[Tuple[float, float, float], str]: ...

View File

@@ -1,8 +1,8 @@
from typing import Any, ClassVar, Mapping, Optional
from typing import Any, ClassVar, Mapping
class Dialog:
command: ClassVar[Optional[str]] = ...
master: Optional[Any] = ...
command: ClassVar[str | None] = ...
master: Any | None = ...
options: Mapping[str, Any] = ...
def __init__(self, master: Optional[Any] = ..., **options) -> None: ...
def __init__(self, master: Any | None = ..., **options) -> None: ...
def show(self, **options) -> Any: ...

View File

@@ -1,10 +1,10 @@
from tkinter import Widget
from typing import Any, Mapping, Optional
from typing import Any, Mapping
DIALOG_ICON: str
class Dialog(Widget):
widgetName: str = ...
num: int = ...
def __init__(self, master: Optional[Any] = ..., cnf: Mapping[str, Any] = ..., **kw) -> None: ...
def __init__(self, master: Any | None = ..., cnf: Mapping[str, Any] = ..., **kw) -> None: ...
def destroy(self) -> None: ...

View File

@@ -1,15 +1,15 @@
from tkinter import Event, Misc, Tk, Widget
from typing import ClassVar, Optional, Protocol
from typing import ClassVar, Protocol
class _DndSource(Protocol):
def dnd_end(self, target: Optional[Widget], event: Optional[Event[Misc]]) -> None: ...
def dnd_end(self, target: Widget | None, event: Event[Misc] | None) -> None: ...
class DndHandler:
root: ClassVar[Optional[Tk]]
root: ClassVar[Tk | None]
def __init__(self, source: _DndSource, event: Event[Misc]) -> None: ...
def cancel(self, event: Optional[Event[Misc]] = ...) -> None: ...
def finish(self, event: Optional[Event[Misc]], commit: int = ...) -> None: ...
def cancel(self, event: Event[Misc] | None = ...) -> None: ...
def finish(self, event: Event[Misc] | None, commit: int = ...) -> None: ...
def on_motion(self, event: Event[Misc]) -> None: ...
def on_release(self, event: Event[Misc]) -> None: ...
def dnd_start(source, event) -> Optional[DndHandler]: ...
def dnd_start(source, event) -> DndHandler | None: ...

View File

@@ -1,6 +1,6 @@
from _typeshed import StrOrBytesPath
from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, _TkinterSequence, commondialog
from typing import IO, Any, ClassVar, Dict, Iterable, Optional, Tuple
from typing import IO, Any, ClassVar, Dict, Iterable, Tuple
from typing_extensions import Literal
dialogstates: Dict[Any, Tuple[Any, Any]]
@@ -8,7 +8,7 @@ dialogstates: Dict[Any, Tuple[Any, Any]]
class FileDialog:
title: str = ...
master: Any = ...
directory: Optional[Any] = ...
directory: Any | None = ...
top: Toplevel = ...
botframe: Frame = ...
selection: Entry = ...
@@ -22,21 +22,21 @@ class FileDialog:
filter_button: Button = ...
cancel_button: Button = ...
def __init__(
self, master, title: Optional[Any] = ...
self, master, title: Any | None = ...
) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either
how: Optional[Any] = ...
def go(self, dir_or_file: Any = ..., pattern: str = ..., default: str = ..., key: Optional[Any] = ...): ...
def quit(self, how: Optional[Any] = ...) -> None: ...
how: Any | None = ...
def go(self, dir_or_file: Any = ..., pattern: str = ..., default: str = ..., key: Any | None = ...): ...
def quit(self, how: Any | None = ...) -> None: ...
def dirs_double_event(self, event) -> None: ...
def dirs_select_event(self, event) -> None: ...
def files_double_event(self, event) -> None: ...
def files_select_event(self, event) -> None: ...
def ok_event(self, event) -> None: ...
def ok_command(self) -> None: ...
def filter_command(self, event: Optional[Any] = ...) -> None: ...
def filter_command(self, event: Any | None = ...) -> None: ...
def get_filter(self): ...
def get_selection(self): ...
def cancel_command(self, event: Optional[Any] = ...) -> None: ...
def cancel_command(self, event: Any | None = ...) -> None: ...
def set_filter(self, dir, pat) -> None: ...
def set_selection(self, file) -> None: ...

View File

@@ -1,6 +1,6 @@
import sys
import tkinter
from typing import Any, Optional, Tuple, Union, overload
from typing import Any, Tuple, Union, overload
from typing_extensions import Literal, TypedDict
NORMAL: Literal["normal"]
@@ -32,9 +32,9 @@ class Font:
self,
# In tkinter, 'root' refers to tkinter.Tk by convention, but the code
# actually works with any tkinter widget so we use tkinter.Misc.
root: Optional[tkinter.Misc] = ...,
font: Optional[_FontDescription] = ...,
name: Optional[str] = ...,
root: tkinter.Misc | None = ...,
font: _FontDescription | None = ...,
name: str | None = ...,
exists: bool = ...,
*,
family: str = ...,
@@ -59,19 +59,19 @@ class Font:
def cget(self, option: str) -> Any: ...
__getitem__ = cget
@overload
def actual(self, option: Literal["family"], displayof: Optional[tkinter.Misc] = ...) -> str: ...
def actual(self, option: Literal["family"], displayof: tkinter.Misc | None = ...) -> str: ...
@overload
def actual(self, option: Literal["size"], displayof: Optional[tkinter.Misc] = ...) -> int: ...
def actual(self, option: Literal["size"], displayof: tkinter.Misc | None = ...) -> int: ...
@overload
def actual(self, option: Literal["weight"], displayof: Optional[tkinter.Misc] = ...) -> Literal["normal", "bold"]: ...
def actual(self, option: Literal["weight"], displayof: tkinter.Misc | None = ...) -> Literal["normal", "bold"]: ...
@overload
def actual(self, option: Literal["slant"], displayof: Optional[tkinter.Misc] = ...) -> Literal["roman", "italic"]: ...
def actual(self, option: Literal["slant"], displayof: tkinter.Misc | None = ...) -> Literal["roman", "italic"]: ...
@overload
def actual(self, option: Literal["underline", "overstrike"], displayof: Optional[tkinter.Misc] = ...) -> bool: ...
def actual(self, option: Literal["underline", "overstrike"], displayof: tkinter.Misc | None = ...) -> bool: ...
@overload
def actual(self, option: None, displayof: Optional[tkinter.Misc] = ...) -> _FontDict: ...
def actual(self, option: None, displayof: tkinter.Misc | None = ...) -> _FontDict: ...
@overload
def actual(self, *, displayof: Optional[tkinter.Misc] = ...) -> _FontDict: ...
def actual(self, *, displayof: tkinter.Misc | None = ...) -> _FontDict: ...
def config(
self,
*,
@@ -81,22 +81,22 @@ class Font:
slant: Literal["roman", "italic"] = ...,
underline: bool = ...,
overstrike: bool = ...,
) -> Optional[_FontDict]: ...
) -> _FontDict | None: ...
configure = config
def copy(self) -> Font: ...
@overload
def metrics(self, __option: Literal["ascent", "descent", "linespace"], *, displayof: Optional[tkinter.Misc] = ...) -> int: ...
def metrics(self, __option: Literal["ascent", "descent", "linespace"], *, displayof: tkinter.Misc | None = ...) -> int: ...
@overload
def metrics(self, __option: Literal["fixed"], *, displayof: Optional[tkinter.Misc] = ...) -> bool: ...
def metrics(self, __option: Literal["fixed"], *, displayof: tkinter.Misc | None = ...) -> bool: ...
@overload
def metrics(self, *, displayof: Optional[tkinter.Misc] = ...) -> _MetricsDict: ...
def measure(self, text: str, displayof: Optional[tkinter.Misc] = ...) -> int: ...
def metrics(self, *, displayof: tkinter.Misc | None = ...) -> _MetricsDict: ...
def measure(self, text: str, displayof: tkinter.Misc | None = ...) -> int: ...
def families(root: Optional[tkinter.Misc] = ..., displayof: Optional[tkinter.Misc] = ...) -> Tuple[str, ...]: ...
def names(root: Optional[tkinter.Misc] = ...) -> Tuple[str, ...]: ...
def families(root: tkinter.Misc | None = ..., displayof: tkinter.Misc | None = ...) -> Tuple[str, ...]: ...
def names(root: tkinter.Misc | None = ...) -> Tuple[str, ...]: ...
if sys.version_info >= (3, 10):
def nametofont(name: str, root: Optional[tkinter.Misc] = ...) -> Font: ...
def nametofont(name: str, root: tkinter.Misc | None = ...) -> Font: ...
else:
def nametofont(name: str) -> Font: ...

View File

@@ -1,5 +1,5 @@
from tkinter.commondialog import Dialog
from typing import Any, ClassVar, Optional
from typing import Any, ClassVar
ERROR: str
INFO: str
@@ -21,11 +21,11 @@ NO: str
class Message(Dialog):
command: ClassVar[str] = ...
def showinfo(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> str: ...
def showwarning(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> str: ...
def showerror(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> str: ...
def askquestion(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> str: ...
def askokcancel(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> bool: ...
def askyesno(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> bool: ...
def askyesnocancel(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> Optional[bool]: ...
def askretrycancel(title: Optional[str] = ..., message: Optional[str] = ..., **options: Any) -> bool: ...
def showinfo(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ...
def showwarning(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ...
def showerror(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ...
def askquestion(title: str | None = ..., message: str | None = ..., **options: Any) -> str: ...
def askokcancel(title: str | None = ..., message: str | None = ..., **options: Any) -> bool: ...
def askyesno(title: str | None = ..., message: str | None = ..., **options: Any) -> bool: ...
def askyesnocancel(title: str | None = ..., message: str | None = ..., **options: Any) -> bool | None: ...
def askretrycancel(title: str | None = ..., message: str | None = ..., **options: Any) -> bool: ...

View File

@@ -1,8 +1,8 @@
from tkinter import Frame, Misc, Scrollbar, Text
from typing import Any, Optional
from typing import Any
# The methods from Pack, Place, and Grid are dynamically added over the parent's impls
class ScrolledText(Text):
frame: Frame
vbar: Scrollbar
def __init__(self, master: Optional[Misc] = ..., **kwargs: Any) -> None: ...
def __init__(self, master: Misc | None = ..., **kwargs: Any) -> None: ...

View File

@@ -1,27 +1,27 @@
from tkinter import Event, Misc, Toplevel
from typing import Any, List, Optional
from typing import Any, List
class Dialog(Toplevel):
def __init__(self, parent: Optional[Misc], title: Optional[str] = ...) -> None: ...
def __init__(self, parent: Misc | None, title: str | None = ...) -> None: ...
def body(self, master) -> None: ...
def buttonbox(self): ...
class SimpleDialog:
def __init__(
self,
master: Optional[Misc],
master: Misc | None,
text: str = ...,
buttons: List[str] = ...,
default: Optional[int] = ...,
cancel: Optional[int] = ...,
title: Optional[str] = ...,
class_: Optional[str] = ...,
default: int | None = ...,
cancel: int | None = ...,
title: str | None = ...,
class_: str | None = ...,
) -> None: ...
def go(self) -> Optional[int]: ...
def go(self) -> int | None: ...
def return_event(self, event: Event[Misc]) -> None: ...
def wm_delete_window(self) -> None: ...
def done(self, num: int) -> None: ...
def askfloat(title: Optional[str], prompt: str, **kwargs: Any) -> float: ...
def askinteger(title: Optional[str], prompt: str, **kwargs: Any) -> int: ...
def askstring(title: Optional[str], prompt: str, **kwargs: Any) -> str: ...
def askfloat(title: str | None, prompt: str, **kwargs: Any) -> float: ...
def askinteger(title: str | None, prompt: str, **kwargs: Any) -> int: ...
def askstring(title: str | None, prompt: str, **kwargs: Any) -> str: ...

View File

@@ -1,5 +1,5 @@
import tkinter
from typing import Any, Dict, List, Optional, Tuple
from typing import Any, Dict, List, Tuple
from typing_extensions import Literal
WINDOW: Literal["window"]
@@ -37,22 +37,22 @@ TCL_ALL_EVENTS: Literal[0]
class tixCommand:
def tix_addbitmapdir(self, directory: str) -> None: ...
def tix_cget(self, option: str) -> Any: ...
def tix_configure(self, cnf: Optional[Dict[str, Any]] = ..., **kw: Any) -> Any: ...
def tix_filedialog(self, dlgclass: Optional[str] = ...) -> str: ...
def tix_configure(self, cnf: Dict[str, Any] | None = ..., **kw: Any) -> Any: ...
def tix_filedialog(self, dlgclass: str | None = ...) -> str: ...
def tix_getbitmap(self, name: str) -> str: ...
def tix_getimage(self, name: str) -> str: ...
def tix_option_get(self, name: str) -> Any: ...
def tix_resetoptions(self, newScheme: str, newFontSet: str, newScmPrio: Optional[str] = ...) -> None: ...
def tix_resetoptions(self, newScheme: str, newFontSet: str, newScmPrio: str | None = ...) -> None: ...
class Tk(tkinter.Tk, tixCommand):
def __init__(self, screenName: Optional[str] = ..., baseName: Optional[str] = ..., className: str = ...): ...
def __init__(self, screenName: str | None = ..., baseName: str | None = ..., className: str = ...): ...
class TixWidget(tkinter.Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
widgetName: Optional[str] = ...,
static_options: Optional[List[str]] = ...,
master: tkinter.Misc | None = ...,
widgetName: str | None = ...,
static_options: List[str] | None = ...,
cnf: Dict[str, Any] = ...,
kw: Dict[str, Any] = ...,
) -> None: ...
@@ -61,9 +61,7 @@ class TixWidget(tkinter.Widget):
def subwidget(self, name: str) -> tkinter.Widget: ...
def subwidgets_all(self) -> List[tkinter.Widget]: ...
def config_all(self, option: Any, value: Any) -> None: ...
def image_create(
self, imgtype: str, cnf: Dict[str, Any] = ..., master: Optional[tkinter.Widget] = ..., **kw: Any
) -> None: ...
def image_create(self, imgtype: str, cnf: Dict[str, Any] = ..., master: tkinter.Widget | None = ..., **kw: Any) -> None: ...
def image_delete(self, imgname: str) -> None: ...
class TixSubWidget(TixWidget):
@@ -72,48 +70,46 @@ class TixSubWidget(TixWidget):
) -> None: ...
class DisplayStyle:
def __init__(
self, itemtype: str, cnf: Dict[str, Any] = ..., *, master: Optional[tkinter.Widget] = ..., **kw: Any
) -> None: ...
def __init__(self, itemtype: str, cnf: Dict[str, Any] = ..., *, master: tkinter.Widget | None = ..., **kw: Any) -> None: ...
def __getitem__(self, key: str) -> Any: ...
def __setitem__(self, key: str, value: Any) -> None: ...
def delete(self) -> None: ...
def config(self, cnf: Dict[str, Any] = ..., **kw: Any) -> Any: ...
class Balloon(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def bind_widget(self, widget: tkinter.Widget, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def unbind_widget(self, widget: tkinter.Widget) -> None: ...
class ButtonBox(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ...
def invoke(self, name: str) -> None: ...
class ComboBox(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add_history(self, str: str) -> None: ...
def append_history(self, str: str) -> None: ...
def insert(self, index: int, str: str) -> None: ...
def pick(self, index: int) -> None: ...
class Control(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def decrement(self) -> None: ...
def increment(self) -> None: ...
def invoke(self) -> None: ...
class LabelEntry(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
class LabelFrame(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
class Meter(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
class OptionMenu(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add_command(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add_separator(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def delete(self, name: str) -> None: ...
@@ -121,59 +117,59 @@ class OptionMenu(TixWidget):
def enable(self, name: str) -> None: ...
class PopupMenu(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def bind_widget(self, widget: tkinter.Widget) -> None: ...
def unbind_widget(self, widget: tkinter.Widget) -> None: ...
def post_widget(self, widget: tkinter.Widget, x: int, y: int) -> None: ...
class Select(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ...
def invoke(self, name: str) -> None: ...
class StdButtonBox(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def invoke(self, name: str) -> None: ...
class DirList(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def chdir(self, dir: str) -> None: ...
class DirTree(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def chdir(self, dir: str) -> None: ...
class DirSelectDialog(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def popup(self) -> None: ...
def popdown(self) -> None: ...
class DirSelectBox(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
class ExFileSelectBox(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def filter(self) -> None: ...
def invoke(self) -> None: ...
class FileSelectBox(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def apply_filter(self) -> None: ...
def invoke(self) -> None: ...
class FileEntry(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def invoke(self) -> None: ...
def file_dialog(self) -> None: ...
class HList(TixWidget, tkinter.XView, tkinter.YView):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ...
def add_child(self, parent: Optional[str] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ...
def add_child(self, parent: str | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> tkinter.Widget: ...
def anchor_set(self, entry: str) -> None: ...
def anchor_clear(self) -> None: ...
# FIXME: Overload, certain combos return, others don't
def column_width(self, col: int = ..., width: Optional[int] = ..., chars: Optional[int] = ...) -> Optional[int]: ...
def column_width(self, col: int = ..., width: int | None = ..., chars: int | None = ...) -> int | None: ...
def delete_all(self) -> None: ...
def delete_entry(self, entry: str) -> None: ...
def delete_offsprings(self, entry: str) -> None: ...
@@ -183,7 +179,7 @@ class HList(TixWidget, tkinter.XView, tkinter.YView):
def dropsite_set(self, index: int) -> None: ...
def dropsite_clear(self) -> None: ...
def header_create(self, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def header_configure(self, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> Optional[Any]: ...
def header_configure(self, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ...
def header_cget(self, col: int, opt: Any) -> Any: ...
def header_exists(self, col: int) -> bool: ...
def header_exist(self, col: int) -> bool: ...
@@ -191,14 +187,14 @@ class HList(TixWidget, tkinter.XView, tkinter.YView):
def header_size(self, col: int) -> int: ...
def hide_entry(self, entry: str) -> None: ...
def indicator_create(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def indicator_configure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Optional[Any]: ...
def indicator_configure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ...
def indicator_cget(self, entry: str, opt: Any) -> Any: ...
def indicator_exists(self, entry: str) -> bool: ...
def indicator_delete(self, entry: str) -> None: ...
def indicator_size(self, entry: str) -> int: ...
def info_anchor(self) -> str: ...
def info_bbox(self, entry: str) -> Tuple[int, int, int, int]: ...
def info_children(self, entry: Optional[str] = ...) -> Tuple[str, ...]: ...
def info_children(self, entry: str | None = ...) -> Tuple[str, ...]: ...
def info_data(self, entry: str) -> Any: ...
def info_dragsite(self) -> str: ...
def info_dropsite(self) -> str: ...
@@ -209,21 +205,21 @@ class HList(TixWidget, tkinter.XView, tkinter.YView):
def info_prev(self, entry: str) -> str: ...
def info_selection(self) -> Tuple[str, ...]: ...
def item_cget(self, entry: str, col: int, opt: Any) -> Any: ...
def item_configure(self, entry: str, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> Optional[Any]: ...
def item_configure(self, entry: str, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ...
def item_create(self, entry: str, col: int, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def item_exists(self, entry: str, col: int) -> bool: ...
def item_delete(self, entry: str, col: int) -> None: ...
def entrycget(self, entry: str, opt: Any) -> Any: ...
def entryconfigure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Optional[Any]: ...
def entryconfigure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ...
def nearest(self, y: int) -> str: ...
def see(self, entry: str) -> None: ...
def selection_clear(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def selection_includes(self, entry: str) -> bool: ...
def selection_set(self, first: str, last: Optional[str] = ...) -> None: ...
def selection_set(self, first: str, last: str | None = ...) -> None: ...
def show_entry(self, entry: str) -> None: ...
class CheckList(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def autosetmode(self) -> None: ...
def close(self, entrypath: str) -> None: ...
def getmode(self, entrypath: str) -> str: ...
@@ -233,7 +229,7 @@ class CheckList(TixWidget):
def setstatus(self, entrypath: str, mode: str = ...) -> None: ...
class Tree(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def autosetmode(self) -> None: ...
def close(self, entrypath: str) -> None: ...
def getmode(self, entrypath: str) -> str: ...
@@ -241,12 +237,12 @@ class Tree(TixWidget):
def setmode(self, entrypath: str, mode: str = ...) -> None: ...
class TList(TixWidget, tkinter.XView, tkinter.YView):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def active_set(self, index: int) -> None: ...
def active_clear(self) -> None: ...
def anchor_set(self, index: int) -> None: ...
def anchor_clear(self) -> None: ...
def delete(self, from_: int, to: Optional[int] = ...) -> None: ...
def delete(self, from_: int, to: int | None = ...) -> None: ...
def dragsite_set(self, index: int) -> None: ...
def dragsite_clear(self) -> None: ...
def dropsite_set(self, index: int) -> None: ...
@@ -264,26 +260,26 @@ class TList(TixWidget, tkinter.XView, tkinter.YView):
def see(self, index: int) -> None: ...
def selection_clear(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def selection_includes(self, index: int) -> bool: ...
def selection_set(self, first: int, last: Optional[int] = ...) -> None: ...
def selection_set(self, first: int, last: int | None = ...) -> None: ...
class PanedWindow(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def delete(self, name: str) -> None: ...
def forget(self, name: str) -> None: ... # type: ignore
def panecget(self, entry: str, opt: Any) -> Any: ...
def paneconfigure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Optional[Any]: ...
def paneconfigure(self, entry: str, cnf: Dict[str, Any] = ..., **kw: Any) -> Any | None: ...
def panes(self) -> List[tkinter.Widget]: ...
class ListNoteBook(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def page(self, name: str) -> tkinter.Widget: ...
def pages(self) -> List[tkinter.Widget]: ...
def raise_page(self, name: str) -> None: ...
class NoteBook(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def delete(self, name: str) -> None: ...
def page(self, name: str) -> tkinter.Widget: ...
@@ -292,7 +288,7 @@ class NoteBook(TixWidget):
def raised(self) -> bool: ...
class InputOnly(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def __init__(self, master: tkinter.Widget | None = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
class Form:
def __setitem__(self, key: str, value: Any) -> None: ...
@@ -300,6 +296,6 @@ class Form:
def form(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def check(self) -> bool: ...
def forget(self) -> None: ...
def grid(self, xsize: int = ..., ysize: int = ...) -> Optional[Tuple[int, int]]: ...
def info(self, option: Optional[str] = ...) -> Any: ...
def grid(self, xsize: int = ..., ysize: int = ...) -> Tuple[int, int] | None: ...
def info(self, option: str | None = ...) -> Any: ...
def slaves(self) -> List[tkinter.Widget]: ...

View File

@@ -2,11 +2,11 @@ import _tkinter
import sys
import tkinter
from tkinter.font import _FontDescription
from typing import Any, Callable, Dict, Optional, Tuple, Union, overload
from typing import Any, Callable, Dict, Tuple, Union, overload
from typing_extensions import Literal, TypedDict
def tclobjs_to_py(adict): ...
def setup_master(master: Optional[Any] = ...): ...
def setup_master(master: Any | None = ...): ...
# from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound
_TtkCompound = Literal["text", "image", tkinter._Compound]
@@ -14,29 +14,29 @@ _TtkCompound = Literal["text", "image", tkinter._Compound]
class Style:
master: Any
tk: _tkinter.TkappType
def __init__(self, master: Optional[Any] = ...): ...
def configure(self, style, query_opt: Optional[Any] = ..., **kw): ...
def map(self, style, query_opt: Optional[Any] = ..., **kw): ...
def lookup(self, style, option, state: Optional[Any] = ..., default: Optional[Any] = ...): ...
def layout(self, style, layoutspec: Optional[Any] = ...): ...
def __init__(self, master: Any | None = ...): ...
def configure(self, style, query_opt: Any | None = ..., **kw): ...
def map(self, style, query_opt: Any | None = ..., **kw): ...
def lookup(self, style, option, state: Any | None = ..., default: Any | None = ...): ...
def layout(self, style, layoutspec: Any | None = ...): ...
def element_create(self, elementname, etype, *args, **kw): ...
def element_names(self): ...
def element_options(self, elementname): ...
def theme_create(self, themename, parent: Optional[Any] = ..., settings: Optional[Any] = ...): ...
def theme_create(self, themename, parent: Any | None = ..., settings: Any | None = ...): ...
def theme_settings(self, themename, settings): ...
def theme_names(self): ...
def theme_use(self, themename: Optional[Any] = ...): ...
def theme_use(self, themename: Any | None = ...): ...
class Widget(tkinter.Widget):
def __init__(self, master: Optional[tkinter.Misc], widgetname, kw: Optional[Any] = ...): ...
def __init__(self, master: tkinter.Misc | None, widgetname, kw: Any | None = ...): ...
def identify(self, x, y): ...
def instate(self, statespec, callback: Optional[Any] = ..., *args, **kw): ...
def state(self, statespec: Optional[Any] = ...): ...
def instate(self, statespec, callback: Any | None = ..., *args, **kw): ...
def state(self, statespec: Any | None = ...): ...
class Button(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
command: tkinter._ButtonCommand = ...,
@@ -49,15 +49,15 @@ class Button(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
width: int | Literal[""] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
@@ -68,11 +68,11 @@ class Button(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
width: int | Literal[""] = ...,
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -81,7 +81,7 @@ class Button(Widget):
class Checkbutton(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
command: tkinter._ButtonCommand = ...,
@@ -95,19 +95,19 @@ class Checkbutton(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
# Seems like variable can be empty string, but actually setting it to
# empty string segfaults before Tcl 8.6.9. Search for ttk::checkbutton
# here: https://sourceforge.net/projects/tcl/files/Tcl/8.6.9/tcltk-release-notes-8.6.9.txt/view
variable: tkinter.Variable = ...,
width: Union[int, Literal[""]] = ...,
width: int | Literal[""] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
@@ -119,12 +119,12 @@ class Checkbutton(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
variable: tkinter.Variable = ...,
width: Union[int, Literal[""]] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
width: int | Literal[""] = ...,
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -133,8 +133,8 @@ class Checkbutton(Widget):
class Entry(Widget, tkinter.Entry):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
widget: Optional[str] = ...,
master: tkinter.Misc | None = ...,
widget: str | None = ...,
*,
background: tkinter._Color = ..., # undocumented
class_: str = ...,
@@ -158,7 +158,7 @@ class Entry(Widget, tkinter.Entry):
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
@@ -176,14 +176,14 @@ class Entry(Widget, tkinter.Entry):
validatecommand: tkinter._EntryValidateCommand = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
# config must be copy/pasted, otherwise ttk.Entry().config is mypy error (don't know why)
@overload # type: ignore
def config(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
@@ -201,7 +201,7 @@ class Entry(Widget, tkinter.Entry):
validatecommand: tkinter._EntryValidateCommand = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
def bbox(self, index): ...
@@ -211,7 +211,7 @@ class Entry(Widget, tkinter.Entry):
class Combobox(Entry):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
background: tkinter._Color = ..., # undocumented
class_: str = ...,
@@ -223,7 +223,7 @@ class Combobox(Entry):
invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented
justify: Literal["left", "center", "right"] = ...,
name: str = ...,
postcommand: Union[Callable[[], Any], str] = ...,
postcommand: Callable[[], Any] | str = ...,
show: Any = ..., # undocumented
state: str = ...,
style: str = ...,
@@ -238,7 +238,7 @@ class Combobox(Entry):
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
@@ -248,7 +248,7 @@ class Combobox(Entry):
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
postcommand: Union[Callable[[], Any], str] = ...,
postcommand: Callable[[], Any] | str = ...,
show: Any = ...,
state: str = ...,
style: str = ...,
@@ -259,14 +259,14 @@ class Combobox(Entry):
values: tkinter._TkinterSequence[str] = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
# config must be copy/pasted, otherwise ttk.Combobox().config is mypy error (don't know why)
@overload # type: ignore
def config(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
@@ -276,7 +276,7 @@ class Combobox(Entry):
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
postcommand: Union[Callable[[], Any], str] = ...,
postcommand: Callable[[], Any] | str = ...,
show: Any = ...,
state: str = ...,
style: str = ...,
@@ -287,16 +287,16 @@ class Combobox(Entry):
values: tkinter._TkinterSequence[str] = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
def current(self, newindex: Optional[Any] = ...): ...
def current(self, newindex: Any | None = ...): ...
def set(self, value): ...
class Frame(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
@@ -313,7 +313,7 @@ class Frame(Widget):
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
@@ -324,7 +324,7 @@ class Frame(Widget):
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: tkinter._ScreenUnits = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -332,7 +332,7 @@ class Frame(Widget):
class Label(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
anchor: tkinter._Anchor = ...,
background: tkinter._Color = ...,
@@ -351,16 +351,16 @@ class Label(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
width: int | Literal[""] = ...,
wraplength: tkinter._ScreenUnits = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
anchor: tkinter._Anchor = ...,
background: tkinter._Color = ...,
@@ -377,12 +377,12 @@ class Label(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
width: int | Literal[""] = ...,
wraplength: tkinter._ScreenUnits = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -390,7 +390,7 @@ class Label(Widget):
class Labelframe(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ..., # undocumented
@@ -404,14 +404,14 @@ class Labelframe(Widget):
relief: tkinter._Relief = ..., # undocumented
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
underline: int = ...,
width: tkinter._ScreenUnits = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
@@ -423,10 +423,10 @@ class Labelframe(Widget):
relief: tkinter._Relief = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
underline: int = ...,
width: tkinter._ScreenUnits = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -436,7 +436,7 @@ LabelFrame = Labelframe
class Menubutton(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
compound: _TtkCompound = ...,
@@ -449,15 +449,15 @@ class Menubutton(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
width: int | Literal[""] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
@@ -468,11 +468,11 @@ class Menubutton(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
width: int | Literal[""] = ...,
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -480,7 +480,7 @@ class Menubutton(Widget):
class Notebook(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
@@ -494,7 +494,7 @@ class Notebook(Widget):
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
cursor: tkinter._Cursor = ...,
height: int = ...,
@@ -502,7 +502,7 @@ class Notebook(Widget):
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -512,15 +512,15 @@ class Notebook(Widget):
def identify(self, x, y): ...
def index(self, tab_id): ...
def insert(self, pos, child, **kw): ...
def select(self, tab_id: Optional[Any] = ...): ...
def tab(self, tab_id, option: Optional[Any] = ..., **kw): ...
def select(self, tab_id: Any | None = ...): ...
def tab(self, tab_id, option: Any | None = ..., **kw): ...
def tabs(self): ...
def enable_traversal(self): ...
class Panedwindow(Widget, tkinter.PanedWindow):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
@@ -535,41 +535,41 @@ class Panedwindow(Widget, tkinter.PanedWindow):
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
cursor: tkinter._Cursor = ...,
height: int = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
# config must be copy/pasted, otherwise ttk.Panedwindow().config is mypy error (don't know why)
@overload # type: ignore
def config(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
cursor: tkinter._Cursor = ...,
height: int = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
forget: Any
def insert(self, pos, child, **kw): ...
def pane(self, pane, option: Optional[Any] = ..., **kw): ...
def sashpos(self, index, newpos: Optional[Any] = ...): ...
def pane(self, pane, option: Any | None = ..., **kw): ...
def sashpos(self, index, newpos: Any | None = ...): ...
PanedWindow = Panedwindow
class Progressbar(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
@@ -582,12 +582,12 @@ class Progressbar(Widget):
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
variable: tkinter.IntVar | tkinter.DoubleVar = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
cursor: tkinter._Cursor = ...,
length: tkinter._ScreenUnits = ...,
@@ -598,19 +598,19 @@ class Progressbar(Widget):
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
variable: tkinter.IntVar | tkinter.DoubleVar = ...,
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
def start(self, interval: Optional[Any] = ...): ...
def step(self, amount: Optional[Any] = ...): ...
def start(self, interval: Any | None = ...): ...
def step(self, amount: Any | None = ...): ...
def stop(self): ...
class Radiobutton(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
command: tkinter._ButtonCommand = ...,
@@ -622,17 +622,17 @@ class Radiobutton(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
value: Any = ...,
variable: Union[tkinter.Variable, Literal[""]] = ...,
width: Union[int, Literal[""]] = ...,
variable: tkinter.Variable | Literal[""] = ...,
width: int | Literal[""] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
@@ -642,13 +642,13 @@ class Radiobutton(Widget):
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: Union[float, str] = ...,
text: float | str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
value: Any = ...,
variable: Union[tkinter.Variable, Literal[""]] = ...,
width: Union[int, Literal[""]] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
variable: tkinter.Variable | Literal[""] = ...,
width: int | Literal[""] = ...,
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -657,10 +657,10 @@ class Radiobutton(Widget):
class Scale(Widget, tkinter.Scale):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
command: Union[str, Callable[[str], Any]] = ...,
command: str | Callable[[str], Any] = ...,
cursor: tkinter._Cursor = ...,
from_: float = ...,
length: tkinter._ScreenUnits = ...,
@@ -671,14 +671,14 @@ class Scale(Widget, tkinter.Scale):
takefocus: tkinter._TakeFocusValue = ...,
to: float = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
variable: tkinter.IntVar | tkinter.DoubleVar = ...,
) -> None: ...
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
command: Union[str, Callable[[str], Any]] = ...,
command: str | Callable[[str], Any] = ...,
cursor: tkinter._Cursor = ...,
from_: float = ...,
length: tkinter._ScreenUnits = ...,
@@ -688,17 +688,17 @@ class Scale(Widget, tkinter.Scale):
takefocus: tkinter._TakeFocusValue = ...,
to: float = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
variable: tkinter.IntVar | tkinter.DoubleVar = ...,
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
# config must be copy/pasted, otherwise ttk.Scale().config is mypy error (don't know why)
@overload # type: ignore
def config(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
command: Union[str, Callable[[str], Any]] = ...,
command: str | Callable[[str], Any] = ...,
cursor: tkinter._Cursor = ...,
from_: float = ...,
length: tkinter._ScreenUnits = ...,
@@ -708,19 +708,19 @@ class Scale(Widget, tkinter.Scale):
takefocus: tkinter._TakeFocusValue = ...,
to: float = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
variable: tkinter.IntVar | tkinter.DoubleVar = ...,
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
def get(self, x: Optional[Any] = ..., y: Optional[Any] = ...): ...
def get(self, x: Any | None = ..., y: Any | None = ...): ...
class Scrollbar(Widget, tkinter.Scrollbar):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ...,
command: Callable[..., Tuple[float, float] | None] | str = ...,
cursor: tkinter._Cursor = ...,
name: str = ...,
orient: Literal["horizontal", "vertical"] = ...,
@@ -730,35 +730,35 @@ class Scrollbar(Widget, tkinter.Scrollbar):
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ...,
command: Callable[..., Tuple[float, float] | None] | str = ...,
cursor: tkinter._Cursor = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
# config must be copy/pasted, otherwise ttk.Scrollbar().config is mypy error (don't know why)
@overload # type: ignore
def config(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ...,
command: Callable[..., Tuple[float, float] | None] | str = ...,
cursor: tkinter._Cursor = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
class Separator(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
@@ -770,13 +770,13 @@ class Separator(Widget):
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
cursor: tkinter._Cursor = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -784,7 +784,7 @@ class Separator(Widget):
class Sizegrip(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
@@ -795,12 +795,12 @@ class Sizegrip(Widget):
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
cursor: tkinter._Cursor = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -809,11 +809,11 @@ if sys.version_info >= (3, 7):
class Spinbox(Entry):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
background: tkinter._Color = ..., # undocumented
class_: str = ...,
command: Union[Callable[[], Any], str, tkinter._TkinterSequence[str]] = ...,
command: Callable[[], Any] | str | tkinter._TkinterSequence[str] = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ..., # undocumented
font: _FontDescription = ..., # undocumented
@@ -840,10 +840,10 @@ if sys.version_info >= (3, 7):
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
background: tkinter._Color = ...,
command: Union[Callable[[], Any], str, tkinter._TkinterSequence[str]] = ...,
command: Callable[[], Any] | str | tkinter._TkinterSequence[str] = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
@@ -865,7 +865,7 @@ if sys.version_info >= (3, 7):
width: int = ...,
wrap: bool = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure # type: ignore
@@ -904,12 +904,12 @@ _TreeviewColumnId = Union[int, str] # manual page: "COLUMN IDENTIFIERS"
class Treeview(Widget, tkinter.XView, tkinter.YView):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
master: tkinter.Misc | None = ...,
*,
class_: str = ...,
columns: Union[str, tkinter._TkinterSequence[str]] = ...,
columns: str | tkinter._TkinterSequence[str] = ...,
cursor: tkinter._Cursor = ...,
displaycolumns: Union[str, tkinter._TkinterSequence[str], tkinter._TkinterSequence[int], Literal["#all"]] = ...,
displaycolumns: str | tkinter._TkinterSequence[str] | tkinter._TkinterSequence[int] | Literal["#all"] = ...,
height: int = ...,
name: str = ...,
padding: tkinter._Padding = ...,
@@ -918,7 +918,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
#
# 'tree headings' is same as ['tree', 'headings'], and I wouldn't be
# surprised if someone was using it.
show: Union[Literal["tree", "headings", "tree headings"], tkinter._TkinterSequence[str]] = ...,
show: Literal["tree", "headings", "tree headings"] | tkinter._TkinterSequence[str] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
@@ -927,20 +927,20 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
cnf: Dict[str, Any] | None = ...,
*,
columns: Union[str, tkinter._TkinterSequence[str]] = ...,
columns: str | tkinter._TkinterSequence[str] = ...,
cursor: tkinter._Cursor = ...,
displaycolumns: Union[str, tkinter._TkinterSequence[str], tkinter._TkinterSequence[int], Literal["#all"]] = ...,
displaycolumns: str | tkinter._TkinterSequence[str] | tkinter._TkinterSequence[int] | Literal["#all"] = ...,
height: int = ...,
padding: tkinter._Padding = ...,
selectmode: Literal["extended", "browse", "none"] = ...,
show: Union[Literal["tree", "headings", "tree headings"], tkinter._TkinterSequence[str]] = ...,
show: Literal["tree", "headings", "tree headings"] | tkinter._TkinterSequence[str] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
yscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
) -> Dict[str, Tuple[str, str, str, Any, Any]] | None: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
@@ -1049,7 +1049,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
if sys.version_info >= (3, 8):
def selection(self) -> Tuple[str, ...]: ...
else:
def selection(self, selop: Optional[Any] = ..., items: Optional[Any] = ...) -> Tuple[str, ...]: ...
def selection(self, selop: Any | None = ..., items: Any | None = ...) -> Tuple[str, ...]: ...
def selection_set(self, items: str | tkinter._TkinterSequence[str]) -> None: ...
def selection_add(self, items: str | tkinter._TkinterSequence[str]) -> None: ...
def selection_remove(self, items: str | tkinter._TkinterSequence[str]) -> None: ...
@@ -1064,10 +1064,10 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
# Also, it's 'callback' instead of 'func' here.
@overload
def tag_bind(
self, tagname: str, sequence: Optional[str] = ..., callback: Optional[Callable[[tkinter.Event[Treeview]], Any]] = ...
self, tagname: str, sequence: str | None = ..., callback: Callable[[tkinter.Event[Treeview]], Any] | None = ...
) -> str: ...
@overload
def tag_bind(self, tagname: str, sequence: Optional[str], callback: str) -> None: ...
def tag_bind(self, tagname: str, sequence: str | None, callback: str) -> None: ...
@overload
def tag_bind(self, tagname: str, *, callback: str) -> None: ...
@overload
@@ -1103,12 +1103,12 @@ class LabeledScale(Frame):
# TODO: don't any-type **kw. That goes to Frame.__init__.
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
variable: Optional[Union[tkinter.IntVar, tkinter.DoubleVar]] = ...,
master: tkinter.Misc | None = ...,
variable: tkinter.IntVar | tkinter.DoubleVar | None = ...,
from_: float = ...,
to: float = ...,
*,
compound: Union[Literal["top"], Literal["bottom"]] = ...,
compound: Literal["top"] | Literal["bottom"] = ...,
**kw: Any,
) -> None: ...
# destroy is overrided, signature does not change
@@ -1119,13 +1119,13 @@ class OptionMenu(Menubutton):
self,
master,
variable,
default: Optional[str] = ...,
default: str | None = ...,
*values: str,
# rest of these are keyword-only because *args syntax used above
style: str = ...,
direction: Union[Literal["above"], Literal["below"], Literal["left"], Literal["right"], Literal["flush"]] = ...,
command: Optional[Callable[[tkinter.StringVar], Any]] = ...,
direction: Literal["above"] | Literal["below"] | Literal["left"] | Literal["right"] | Literal["flush"] = ...,
command: Callable[[tkinter.StringVar], Any] | None = ...,
) -> None: ...
# configure, config, cget, destroy are inherited from Menubutton
# destroy and __setitem__ are overrided, signature does not change
def set_menu(self, default: Optional[Any] = ..., *values): ...
def set_menu(self, default: Any | None = ..., *values): ...