Re-organize directory structure (#4971)

See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
Ivan Levkivskyi
2021-01-27 12:00:39 +00:00
committed by GitHub
parent 869238e587
commit 16ae4c6120
1399 changed files with 601 additions and 97 deletions

2980
stdlib/tkinter/__init__.pyi Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
from tkinter.commondialog import Dialog
from typing import Any, ClassVar, Optional, Tuple, Union
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]]: ...

View File

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

View File

@@ -0,0 +1,80 @@
from typing_extensions import Literal
# These are not actually bools. See #4669
NO: bool
YES: bool
TRUE: bool
FALSE: bool
ON: bool
OFF: bool
N: Literal["n"]
S: Literal["s"]
W: Literal["w"]
E: Literal["e"]
NW: Literal["nw"]
SW: Literal["sw"]
NE: Literal["ne"]
SE: Literal["se"]
NS: Literal["ns"]
EW: Literal["ew"]
NSEW: Literal["nsew"]
CENTER: Literal["center"]
NONE: Literal["none"]
X: Literal["x"]
Y: Literal["y"]
BOTH: Literal["both"]
LEFT: Literal["left"]
TOP: Literal["top"]
RIGHT: Literal["right"]
BOTTOM: Literal["bottom"]
RAISED: Literal["raised"]
SUNKEN: Literal["sunken"]
FLAT: Literal["flat"]
RIDGE: Literal["ridge"]
GROOVE: Literal["groove"]
SOLID: Literal["solid"]
HORIZONTAL: Literal["horizontal"]
VERTICAL: Literal["vertical"]
NUMERIC: Literal["numeric"]
CHAR: Literal["char"]
WORD: Literal["word"]
BASELINE: Literal["baseline"]
INSIDE: Literal["inside"]
OUTSIDE: Literal["outside"]
SEL: Literal["sel"]
SEL_FIRST: Literal["sel.first"]
SEL_LAST: Literal["sel.last"]
END: Literal["end"]
INSERT: Literal["insert"]
CURRENT: Literal["current"]
ANCHOR: Literal["anchor"]
ALL: Literal["all"]
NORMAL: Literal["normal"]
DISABLED: Literal["disabled"]
ACTIVE: Literal["active"]
HIDDEN: Literal["hidden"]
CASCADE: Literal["cascade"]
CHECKBUTTON: Literal["checkbutton"]
COMMAND: Literal["command"]
RADIOBUTTON: Literal["radiobutton"]
SEPARATOR: Literal["separator"]
SINGLE: Literal["single"]
BROWSE: Literal["browse"]
MULTIPLE: Literal["multiple"]
EXTENDED: Literal["extended"]
DOTBOX: Literal["dotbox"]
UNDERLINE: Literal["underline"]
PIESLICE: Literal["pieslice"]
CHORD: Literal["chord"]
ARC: Literal["arc"]
FIRST: Literal["first"]
LAST: Literal["last"]
BUTT: Literal["butt"]
PROJECTING: Literal["projecting"]
ROUND: Literal["round"]
BEVEL: Literal["bevel"]
MITER: Literal["miter"]
MOVETO: Literal["moveto"]
SCROLL: Literal["scroll"]
UNITS: Literal["units"]
PAGES: Literal["pages"]

10
stdlib/tkinter/dialog.pyi Normal file
View File

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

13
stdlib/tkinter/dnd.pyi Normal file
View File

@@ -0,0 +1,13 @@
from _typeshed.tkinter import DndSource
from tkinter import Event, Misc, Tk
from typing import ClassVar, Optional
class DndHandler:
root: ClassVar[Optional[Tk]]
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 on_motion(self, event: Event[Misc]) -> None: ...
def on_release(self, event: Event[Misc]) -> None: ...
def dnd_start(source, event) -> Optional[DndHandler]: ...

View File

@@ -0,0 +1,67 @@
from tkinter import Button, Entry, Frame, Listbox, Scrollbar, Toplevel, commondialog
from typing import Any, ClassVar, Dict, Optional, Tuple
dialogstates: Dict[Any, Tuple[Any, Any]]
class FileDialog:
title: str = ...
master: Any = ...
directory: Optional[Any] = ...
top: Toplevel = ...
botframe: Frame = ...
selection: Entry = ...
filter: Entry = ...
midframe: Entry = ...
filesbar: Scrollbar = ...
files: Listbox = ...
dirsbar: Scrollbar = ...
dirs: Listbox = ...
ok_button: Button = ...
filter_button: Button = ...
cancel_button: Button = ...
def __init__(
self, master, title: Optional[Any] = ...
) -> 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: ...
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 get_filter(self): ...
def get_selection(self): ...
def cancel_command(self, event: Optional[Any] = ...) -> None: ...
def set_filter(self, dir, pat) -> None: ...
def set_selection(self, file) -> None: ...
class LoadFileDialog(FileDialog):
title: str = ...
def ok_command(self) -> None: ...
class SaveFileDialog(FileDialog):
title: str = ...
def ok_command(self): ...
class _Dialog(commondialog.Dialog): ...
class Open(_Dialog):
command: ClassVar[str] = ...
class SaveAs(_Dialog):
command: ClassVar[str] = ...
class Directory(commondialog.Dialog):
command: ClassVar[str] = ...
def askopenfilename(**options): ...
def asksaveasfilename(**options): ...
def askopenfilenames(**options): ...
def askopenfile(mode: str = ..., **options): ...
def askopenfiles(mode: str = ..., **options): ...
def asksaveasfile(mode: str = ..., **options): ...
def askdirectory(**options): ...
def test() -> None: ...

98
stdlib/tkinter/font.pyi Normal file
View File

@@ -0,0 +1,98 @@
import tkinter
from typing import Any, List, Optional, Tuple, TypeVar, Union, overload
from typing_extensions import Literal, TypedDict
NORMAL: Literal["normal"]
ROMAN: Literal["roman"]
BOLD: Literal["bold"]
ITALIC: Literal["italic"]
def nametofont(name: str) -> Font: ...
# See 'FONT DESCRIPTIONS' in font man page. This uses str because Literal
# inside Tuple doesn't work.
_FontDescription = Union[str, Font, Tuple[str, int], Tuple[str, int, str], Tuple[str, int, tkinter._TkinterSequence[str]]]
class _FontDict(TypedDict):
family: str
size: int
weight: Literal["normal", "bold"]
slant: Literal["roman", "italic"]
underline: bool
overstrike: bool
class _MetricsDict(TypedDict):
ascent: int
descent: int
linespace: int
fixed: bool
class Font:
name: str
delete_font: bool
def __init__(
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] = ...,
exists: bool = ...,
*,
family: str = ...,
size: int = ...,
weight: Literal["normal", "bold"] = ...,
slant: Literal["roman", "italic"] = ...,
underline: bool = ...,
overstrike: bool = ...,
) -> None: ...
def __setitem__(self, key: str, value: Any) -> None: ...
@overload
def cget(self, option: Literal["family"]) -> str: ...
@overload
def cget(self, option: Literal["size"]) -> int: ...
@overload
def cget(self, option: Literal["weight"]) -> Literal["normal", "bold"]: ...
@overload
def cget(self, option: Literal["slant"]) -> Literal["roman", "italic"]: ...
@overload
def cget(self, option: Literal["underline", "overstrike"]) -> bool: ...
@overload
def cget(self, option: str) -> Any: ...
__getitem__ = cget
@overload
def actual(self, option: Literal["family"], displayof: Optional[tkinter.Misc] = ...) -> str: ...
@overload
def actual(self, option: Literal["size"], displayof: Optional[tkinter.Misc] = ...) -> int: ...
@overload
def actual(self, option: Literal["weight"], displayof: Optional[tkinter.Misc] = ...) -> Literal["normal", "bold"]: ...
@overload
def actual(self, option: Literal["slant"], displayof: Optional[tkinter.Misc] = ...) -> Literal["roman", "italic"]: ...
@overload
def actual(self, option: Literal["underline", "overstrike"], displayof: Optional[tkinter.Misc] = ...) -> bool: ...
@overload
def actual(self, option: None, displayof: Optional[tkinter.Misc] = ...) -> _FontDict: ...
@overload
def actual(self, *, displayof: Optional[tkinter.Misc] = ...) -> _FontDict: ...
def config(
self,
*,
family: str = ...,
size: int = ...,
weight: Literal["normal", "bold"] = ...,
slant: Literal["roman", "italic"] = ...,
underline: bool = ...,
overstrike: bool = ...,
) -> Optional[_FontDict]: ...
configure = config
def copy(self) -> Font: ...
@overload
def metrics(self, __option: Literal["ascent", "descent", "linespace"], *, displayof: Optional[tkinter.Misc] = ...) -> int: ...
@overload
def metrics(self, __option: Literal["fixed"], *, displayof: Optional[tkinter.Misc] = ...) -> bool: ...
@overload
def metrics(self, *, displayof: Optional[tkinter.Misc] = ...) -> _MetricsDict: ...
def measure(self, text: str, displayof: Optional[tkinter.Misc] = ...) -> int: ...
def families(root: Optional[tkinter.Misc] = ..., displayof: Optional[tkinter.Misc] = ...) -> Tuple[str, ...]: ...
def names(root: Optional[tkinter.Misc] = ...) -> Tuple[str, ...]: ...

View File

@@ -0,0 +1,31 @@
from tkinter.commondialog import Dialog
from typing import Any, ClassVar, Optional
ERROR: str
INFO: str
QUESTION: str
WARNING: str
ABORTRETRYIGNORE: str
OK: str
OKCANCEL: str
RETRYCANCEL: str
YESNO: str
YESNOCANCEL: str
ABORT: str
RETRY: str
IGNORE: str
CANCEL: str
YES: str
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: ...

View File

@@ -0,0 +1,8 @@
from tkinter import Frame, Grid, Misc, Pack, Place, Scrollbar, Text
from typing import Any, Optional
# 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: ...

View File

@@ -0,0 +1,27 @@
from tkinter import Event, Misc, Toplevel
from typing import Any, List, Optional
class Dialog(Toplevel):
def __init__(self, parent: Optional[Misc], title: Optional[str] = ...) -> None: ...
def body(self, master) -> None: ...
def buttonbox(self): ...
class SimpleDialog:
def __init__(
self,
master: Optional[Misc],
text: str = ...,
buttons: List[str] = ...,
default: Optional[int] = ...,
cancel: Optional[int] = ...,
title: Optional[str] = ...,
class_: Optional[str] = ...,
) -> None: ...
def go(self) -> Optional[int]: ...
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: ...

305
stdlib/tkinter/tix.pyi Normal file
View File

@@ -0,0 +1,305 @@
import tkinter
from typing import Any, Dict, List, Optional, Tuple
from typing_extensions import Literal
WINDOW: Literal["window"]
TEXT: Literal["text"]
STATUS: Literal["status"]
IMMEDIATE: Literal["immediate"]
IMAGE: Literal["image"]
IMAGETEXT: Literal["imagetext"]
BALLOON: Literal["balloon"]
AUTO: Literal["auto"]
ACROSSTOP: Literal["acrosstop"]
ASCII: Literal["ascii"]
CELL: Literal["cell"]
COLUMN: Literal["column"]
DECREASING: Literal["decreasing"]
INCREASING: Literal["increasing"]
INTEGER: Literal["integer"]
MAIN: Literal["main"]
MAX: Literal["max"]
REAL: Literal["real"]
ROW: Literal["row"]
S_REGION: Literal["s-region"]
X_REGION: Literal["x-region"]
Y_REGION: Literal["y-region"]
# These should be kept in sync with _tkinter constants, except TCL_ALL_EVENTS which doesn't match ALL_EVENTS
TCL_DONT_WAIT: Literal[2]
TCL_WINDOW_EVENTS: Literal[4]
TCL_FILE_EVENTS: Literal[8]
TCL_TIMER_EVENTS: Literal[16]
TCL_IDLE_EVENTS: Literal[32]
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_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: ...
class Tk(tkinter.Tk, tixCommand):
def __init__(self, screenName: Optional[str] = ..., baseName: Optional[str] = ..., className: str = ...): ...
class TixWidget(tkinter.Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
widgetName: Optional[str] = ...,
static_options: Optional[List[str]] = ...,
cnf: Dict[str, Any] = ...,
kw: Dict[str, Any] = ...,
) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def set_silent(self, value: str) -> None: ...
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_delete(self, imgname: str) -> None: ...
class TixSubWidget(TixWidget):
def __init__(
self, master: tkinter.Widget, name: str, destroy_physically: int = ..., check_intermediate: int = ...
) -> None: ...
class DisplayStyle:
def __init__(
self, itemtype: str, cnf: Dict[str, Any] = ..., *, master: Optional[tkinter.Widget] = ..., **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 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 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 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 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: ...
class LabelFrame(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
class Meter(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., 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 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: ...
def disable(self, name: str) -> None: ...
def enable(self, name: str) -> None: ...
class PopupMenu(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], 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 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 invoke(self, name: str) -> None: ...
class DirList(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], 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 chdir(self, dir: str) -> None: ...
class DirSelectDialog(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], 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: ...
class ExFileSelectBox(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], 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 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 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 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 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 delete_all(self) -> None: ...
def delete_entry(self, entry: str) -> None: ...
def delete_offsprings(self, entry: str) -> None: ...
def delete_siblings(self, entry: str) -> None: ...
def dragsite_set(self, index: int) -> None: ...
def dragsite_clear(self) -> None: ...
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_cget(self, col: int, opt: Any) -> Any: ...
def header_exists(self, col: int) -> bool: ...
def header_exist(self, col: int) -> bool: ...
def header_delete(self, col: int) -> None: ...
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_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_data(self, entry: str) -> Any: ...
def info_dragsite(self) -> str: ...
def info_dropsite(self) -> str: ...
def info_exists(self, entry: str) -> bool: ...
def info_hidden(self, entry: str) -> bool: ...
def info_next(self, entry: str) -> str: ...
def info_parent(self, entry: str) -> str: ...
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_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 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 show_entry(self, entry: str) -> None: ...
class CheckList(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def autosetmode(self) -> None: ...
def close(self, entrypath: str) -> None: ...
def getmode(self, entrypath: str) -> str: ...
def open(self, entrypath: str) -> None: ...
def getselection(self, mode: str = ...) -> Tuple[str, ...]: ...
def getstatus(self, entrypath: str) -> str: ...
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 autosetmode(self) -> None: ...
def close(self, entrypath: str) -> None: ...
def getmode(self, entrypath: str) -> str: ...
def open(self, entrypath: str) -> None: ...
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 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 dragsite_set(self, index: int) -> None: ...
def dragsite_clear(self) -> None: ...
def dropsite_set(self, index: int) -> None: ...
def dropsite_clear(self) -> None: ...
def insert(self, index: int, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def info_active(self) -> int: ...
def info_anchor(self) -> int: ...
def info_down(self, index: int) -> int: ...
def info_left(self, index: int) -> int: ...
def info_right(self, index: int) -> int: ...
def info_selection(self) -> Tuple[int, ...]: ...
def info_size(self) -> int: ...
def info_up(self, index: int) -> int: ...
def nearest(self, x: int, y: int) -> int: ...
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: ...
class PanedWindow(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], 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 panes(self) -> List[tkinter.Widget]: ...
class ListNoteBook(TixWidget):
def __init__(self, master: Optional[tkinter.Widget], 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 add(self, name: str, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
def delete(self, name: str) -> None: ...
def page(self, name: str) -> tkinter.Widget: ...
def pages(self) -> List[tkinter.Widget]: ...
def raise_page(self, name: str) -> None: ...
def raised(self) -> bool: ...
class InputOnly(TixWidget):
def __init__(self, master: Optional[tkinter.Widget] = ..., cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
class Form:
def __setitem__(self, key: str, value: Any) -> None: ...
def config(self, cnf: Dict[str, Any] = ..., **kw: Any) -> None: ...
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 slaves(self) -> List[tkinter.Widget]: ...

996
stdlib/tkinter/ttk.pyi Normal file
View File

@@ -0,0 +1,996 @@
import _tkinter
import sys
import tkinter
from tkinter.font import _FontDescription
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, overload
from typing_extensions import Literal
def tclobjs_to_py(adict): ...
def setup_master(master: Optional[Any] = ...): ...
# from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound
_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 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_settings(self, themename, settings): ...
def theme_names(self): ...
def theme_use(self, themename: Optional[Any] = ...): ...
class Widget(tkinter.Widget):
def __init__(self, master: Optional[tkinter.Misc], widgetname, kw: Optional[Any] = ...): ...
def identify(self, x, y): ...
def instate(self, statespec, callback: Optional[Any] = ..., *args, **kw): ...
def state(self, statespec: Optional[Any] = ...): ...
class Button(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
default: Literal["normal", "active", "disabled"] = ...,
image: tkinter._ImageSpec = ...,
name: str = ...,
padding: Any = ..., # undocumented
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
default: Literal["normal", "active", "disabled"] = ...,
image: tkinter._ImageSpec = ...,
padding: Any = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
def invoke(self): ...
class Checkbutton(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
image: tkinter._ImageSpec = ...,
name: str = ...,
offvalue: Any = ...,
onvalue: Any = ...,
padding: Any = ..., # undocumented
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: 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[""]] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
image: tkinter._ImageSpec = ...,
offvalue: Any = ...,
onvalue: Any = ...,
padding: Any = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
variable: tkinter.Variable = ...,
width: Union[int, Literal[""]] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
def invoke(self): ...
class Entry(Widget, tkinter.Entry):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
widget: Optional[str] = ...,
*,
background: tkinter._Color = ..., # undocumented
class_: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
name: str = ...,
show: str = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
validatecommand: tkinter._EntryValidateCommand = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> None: ...
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
show: str = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
validatecommand: tkinter._EntryValidateCommand = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@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]] = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
show: str = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
validatecommand: tkinter._EntryValidateCommand = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
def bbox(self, index): ...
def identify(self, x, y): ...
def validate(self): ...
class Combobox(Entry):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
background: tkinter._Color = ..., # undocumented
class_: str = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ..., # undocumented
foreground: tkinter._Color = ..., # undocumented
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented
justify: Literal["left", "center", "right"] = ...,
name: str = ...,
postcommand: Union[Callable[[], Any], str] = ...,
show: Any = ..., # undocumented
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., # undocumented
validatecommand: tkinter._EntryValidateCommand = ..., # undocumented
values: tkinter._TkinterSequence[str] = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ..., # undocumented
) -> None: ...
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
postcommand: Union[Callable[[], Any], str] = ...,
show: Any = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
validatecommand: tkinter._EntryValidateCommand = ...,
values: tkinter._TkinterSequence[str] = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@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]] = ...,
*,
background: tkinter._Color = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
height: int = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
postcommand: Union[Callable[[], Any], str] = ...,
show: Any = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
validatecommand: tkinter._EntryValidateCommand = ...,
values: tkinter._TkinterSequence[str] = ...,
width: int = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
def current(self, newindex: Optional[Any] = ...): ...
def set(self, value): ...
class Frame(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
class_: str = ...,
cursor: tkinter._Cursor = ...,
height: tkinter._ScreenUnits = ...,
name: str = ...,
padding: tkinter._Padding = ...,
relief: tkinter._Relief = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: tkinter._ScreenUnits = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
cursor: tkinter._Cursor = ...,
height: tkinter._ScreenUnits = ...,
padding: tkinter._Padding = ...,
relief: tkinter._Relief = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: tkinter._ScreenUnits = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
class Label(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
anchor: tkinter._Anchor = ...,
background: tkinter._Color = ...,
border: tkinter._ScreenUnits = ..., # alias for borderwidth
borderwidth: tkinter._ScreenUnits = ..., # undocumented
class_: str = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
image: tkinter._ImageSpec = ...,
justify: Literal["left", "center", "right"] = ...,
name: str = ...,
padding: tkinter._Padding = ...,
relief: tkinter._Relief = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
wraplength: tkinter._ScreenUnits = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
anchor: tkinter._Anchor = ...,
background: tkinter._Color = ...,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
image: tkinter._ImageSpec = ...,
justify: Literal["left", "center", "right"] = ...,
padding: tkinter._Padding = ...,
relief: tkinter._Relief = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
wraplength: tkinter._ScreenUnits = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
class Labelframe(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ..., # undocumented
class_: str = ...,
cursor: tkinter._Cursor = ...,
height: tkinter._ScreenUnits = ...,
labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ...,
labelwidget: tkinter.Misc = ...,
name: str = ...,
padding: tkinter._Padding = ...,
relief: tkinter._Relief = ..., # undocumented
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
underline: int = ...,
width: tkinter._ScreenUnits = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
border: tkinter._ScreenUnits = ...,
borderwidth: tkinter._ScreenUnits = ...,
cursor: tkinter._Cursor = ...,
height: tkinter._ScreenUnits = ...,
labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ...,
labelwidget: tkinter.Misc = ...,
padding: tkinter._Padding = ...,
relief: tkinter._Relief = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
underline: int = ...,
width: tkinter._ScreenUnits = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
LabelFrame = Labelframe
class Menubutton(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
direction: Literal["above", "below", "left", "right", "flush"] = ...,
image: tkinter._ImageSpec = ...,
menu: tkinter.Menu = ...,
name: str = ...,
padding: Any = ..., # undocumented
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
direction: Literal["above", "below", "left", "right", "flush"] = ...,
image: tkinter._ImageSpec = ...,
menu: tkinter.Menu = ...,
padding: Any = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
width: Union[int, Literal[""]] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
class Notebook(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
height: int = ...,
name: str = ...,
padding: tkinter._Padding = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
cursor: tkinter._Cursor = ...,
height: int = ...,
padding: tkinter._Padding = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
def add(self, child, **kw): ...
def forget(self, tab_id): ...
def hide(self, tab_id): ...
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 tabs(self): ...
def enable_traversal(self): ...
class Panedwindow(Widget, tkinter.PanedWindow):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
# width and height for tkinter.ttk.Panedwindow are int but for tkinter.PanedWindow they are screen units
height: int = ...,
name: str = ...,
orient: Literal["vertical", "horizontal"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> None: ...
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
cursor: tkinter._Cursor = ...,
height: int = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@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]] = ...,
*,
cursor: tkinter._Cursor = ...,
height: int = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
width: int = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@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] = ...): ...
PanedWindow = Panedwindow
class Progressbar(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
length: tkinter._ScreenUnits = ...,
maximum: float = ...,
mode: Literal["determinate", "indeterminate"] = ...,
name: str = ...,
orient: Literal["horizontal", "vertical"] = ...,
phase: int = ..., # docs say read-only but assigning int to this works
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
cursor: tkinter._Cursor = ...,
length: tkinter._ScreenUnits = ...,
maximum: float = ...,
mode: Literal["determinate", "indeterminate"] = ...,
orient: Literal["horizontal", "vertical"] = ...,
phase: int = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@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 stop(self): ...
class Radiobutton(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
image: tkinter._ImageSpec = ...,
name: str = ...,
padding: Any = ..., # undocumented
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: str = ...,
textvariable: tkinter.Variable = ...,
underline: int = ...,
value: Any = ...,
variable: Union[tkinter.Variable, Literal[""]] = ...,
width: Union[int, Literal[""]] = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
command: tkinter._ButtonCommand = ...,
compound: _TtkCompound = ...,
cursor: tkinter._Cursor = ...,
image: tkinter._ImageSpec = ...,
padding: Any = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
text: 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]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
def invoke(self): ...
class Scale(Widget, tkinter.Scale):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
command: Union[str, Callable[[str], Any]] = ...,
cursor: tkinter._Cursor = ...,
from_: float = ...,
length: tkinter._ScreenUnits = ...,
name: str = ...,
orient: Literal["horizontal", "vertical"] = ...,
state: str = ..., # undocumented
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
to: float = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> None: ...
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
command: Union[str, Callable[[str], Any]] = ...,
cursor: tkinter._Cursor = ...,
from_: float = ...,
length: tkinter._ScreenUnits = ...,
orient: Literal["horizontal", "vertical"] = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
to: float = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@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]] = ...,
*,
command: Union[str, Callable[[str], Any]] = ...,
cursor: tkinter._Cursor = ...,
from_: float = ...,
length: tkinter._ScreenUnits = ...,
orient: Literal["horizontal", "vertical"] = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
to: float = ...,
value: float = ...,
variable: Union[tkinter.IntVar, tkinter.DoubleVar] = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
def get(self, x: Optional[Any] = ..., y: Optional[Any] = ...): ...
class Scrollbar(Widget, tkinter.Scrollbar):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ...,
cursor: tkinter._Cursor = ...,
name: str = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> None: ...
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ...,
cursor: tkinter._Cursor = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@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]] = ...,
*,
command: Union[Callable[..., Optional[Tuple[float, float]]], str] = ...,
cursor: tkinter._Cursor = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def config(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
class Separator(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
name: str = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
cursor: tkinter._Cursor = ...,
orient: Literal["horizontal", "vertical"] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
class Sizegrip(Widget):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
cursor: tkinter._Cursor = ...,
name: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
cursor: tkinter._Cursor = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
if sys.version_info >= (3, 7):
class Spinbox(Entry):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
background: tkinter._Color = ..., # undocumented
class_: str = ...,
command: Union[Callable[[], Any], str, tkinter._TkinterSequence[str]] = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ..., # undocumented
font: _FontDescription = ..., # undocumented
foreground: tkinter._Color = ..., # undocumented
format: str = ...,
from_: float = ...,
increment: float = ...,
invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented
justify: Literal["left", "center", "right"] = ..., # undocumented
name: str = ...,
show: Any = ..., # undocumented
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ..., # undocumented
to: float = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
validatecommand: tkinter._EntryValidateCommand = ...,
values: tkinter._TkinterSequence[str] = ...,
width: int = ..., # undocumented
wrap: bool = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> None: ...
@overload # type: ignore
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
background: tkinter._Color = ...,
command: Union[Callable[[], Any], str, tkinter._TkinterSequence[str]] = ...,
cursor: tkinter._Cursor = ...,
exportselection: bool = ...,
font: _FontDescription = ...,
foreground: tkinter._Color = ...,
format: str = ...,
from_: float = ...,
increment: float = ...,
invalidcommand: tkinter._EntryValidateCommand = ...,
justify: Literal["left", "center", "right"] = ...,
show: Any = ...,
state: str = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
textvariable: tkinter.Variable = ...,
to: float = ...,
validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
validatecommand: tkinter._EntryValidateCommand = ...,
values: tkinter._TkinterSequence[str] = ...,
width: int = ...,
wrap: bool = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure # type: ignore
def set(self, value: Any) -> None: ...
class Treeview(Widget, tkinter.XView, tkinter.YView):
def __init__(
self,
master: Optional[tkinter.Misc] = ...,
*,
class_: str = ...,
columns: Union[str, tkinter._TkinterSequence[str]] = ...,
cursor: tkinter._Cursor = ...,
displaycolumns: Union[str, tkinter._TkinterSequence[str], tkinter._TkinterSequence[int], Literal["#all"]] = ...,
height: int = ...,
name: str = ...,
padding: tkinter._Padding = ...,
selectmode: Literal["extended", "browse", "none"] = ...,
# _TkinterSequences of Literal don't actually work, using str instead.
#
# '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]] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
yscrollcommand: tkinter._XYScrollCommand = ...,
) -> None: ...
@overload
def configure(
self,
cnf: Optional[Dict[str, Any]] = ...,
*,
columns: Union[str, tkinter._TkinterSequence[str]] = ...,
cursor: tkinter._Cursor = ...,
displaycolumns: Union[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]] = ...,
style: str = ...,
takefocus: tkinter._TakeFocusValue = ...,
xscrollcommand: tkinter._XYScrollCommand = ...,
yscrollcommand: tkinter._XYScrollCommand = ...,
) -> Optional[Dict[str, Tuple[str, str, str, Any, Any]]]: ...
@overload
def configure(self, cnf: str) -> Tuple[str, str, str, Any, Any]: ...
config = configure
def bbox(self, item, column: Optional[Any] = ...): ... # type: ignore
def get_children(self, item: Optional[Any] = ...): ...
def set_children(self, item, *newchildren): ...
def column(self, column, option: Optional[Any] = ..., **kw): ...
def delete(self, *items): ...
def detach(self, *items): ...
def exists(self, item): ...
def focus(self, item: Optional[Any] = ...): ...
def heading(self, column, option: Optional[Any] = ..., **kw): ...
def identify(self, component, x, y): ...
def identify_row(self, y): ...
def identify_column(self, x): ...
def identify_region(self, x, y): ...
def identify_element(self, x, y): ...
def index(self, item): ...
def insert(self, parent, index, iid: Optional[Any] = ..., **kw): ...
def item(self, item, option: Optional[Any] = ..., **kw): ...
def move(self, item, parent, index): ...
reattach: Any
def next(self, item): ...
def parent(self, item): ...
def prev(self, item): ...
def see(self, item): ...
if sys.version_info >= (3, 8):
def selection(self) -> List[Any]: ...
else:
def selection(self, selop: Optional[Any] = ..., items: Optional[Any] = ...) -> List[Any]: ...
def selection_set(self, items): ...
def selection_add(self, items): ...
def selection_remove(self, items): ...
def selection_toggle(self, items): ...
def set(self, item, column: Optional[Any] = ..., value: Optional[Any] = ...): ...
# There's no tag_unbind() or 'add' argument for whatever reason.
# Also, it's 'callback' instead of 'func' here.
@overload
def tag_bind(
self,
tagname: str,
sequence: Optional[str] = ...,
callback: Optional[Callable[[tkinter.Event[Treeview]], Optional[Literal["break"]]]] = ...,
) -> str: ...
@overload
def tag_bind(self, tagname: str, sequence: Optional[str], callback: str) -> None: ...
@overload
def tag_bind(self, tagname: str, *, callback: str) -> None: ...
def tag_configure(self, tagname, option: Optional[Any] = ..., **kw): ...
def tag_has(self, tagname, item: Optional[Any] = ...): ...
class LabeledScale(Frame):
label: Any
scale: Any
# 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]] = ...,
from_: float = ...,
to: float = ...,
*,
compound: Union[Literal["top"], Literal["bottom"]] = ...,
**kw: Any,
) -> None: ...
# destroy is overrided, signature does not change
value: Any
class OptionMenu(Menubutton):
def __init__(
self,
master,
variable,
default: Optional[str] = ...,
*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]] = ...,
) -> 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): ...