massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / tkinter / __init__.pyi
1 import _tkinter
2 import sys
3 from _typeshed import StrOrBytesPath
4 from enum import Enum
5 from tkinter.constants import *  # comment this out to find undefined identifier names with flake8
6 from tkinter.font import _FontDescription
7 from types import TracebackType
8 from typing import Any, Callable, Generic, List, Mapping, Optional, Protocol, Sequence, Tuple, Type, TypeVar, Union, overload
9 from typing_extensions import Literal, TypedDict
10
11 # Using anything from tkinter.font in this file means that 'import tkinter'
12 # seems to also load tkinter.font. That's not how it actually works, but
13 # unfortunately not much can be done about it. https://github.com/python/typeshed/pull/4346
14
15 TclError = _tkinter.TclError
16 wantobjects: int
17 TkVersion: float
18 TclVersion: float
19 READABLE = _tkinter.READABLE
20 WRITABLE = _tkinter.WRITABLE
21 EXCEPTION = _tkinter.EXCEPTION
22
23 # Quick guide for figuring out which widget class to choose:
24 #   - Misc: any widget (don't use BaseWidget because Tk doesn't inherit from BaseWidget)
25 #   - Widget: anything that is meant to be put into another widget with e.g. pack or grid
26 #
27 # Instructions for figuring out the correct type of each widget option:
28 #  - See discussion on #4363.
29 #
30 #  - Find the option from the manual page of the widget. Usually the manual
31 #    page of a non-ttk widget has the same name as the tkinter class, in the
32 #    3tk section:
33 #
34 #        $ sudo apt install tk-doc
35 #        $ man 3tk label
36 #
37 #    Ttk manual pages tend to have ttk_ prefixed names:
38 #
39 #        $ man 3tk ttk_label
40 #
41 #    Non-GUI things like the .after() method are often in the 3tcl section:
42 #
43 #        $ sudo apt install tcl-doc
44 #        $ man 3tcl after
45 #
46 #    If you don't have man or apt, you can read these manual pages online:
47 #
48 #        https://www.tcl.tk/doc/
49 #
50 #    Every option has '-' in front of its name in the manual page (and in Tcl).
51 #    For example, there's an option named '-text' in the label manual page.
52 #
53 #  - Tkinter has some options documented in docstrings, but don't rely on them.
54 #    They aren't updated when a new version of Tk comes out, so the latest Tk
55 #    manual pages (see above) are much more likely to actually contain all
56 #    possible options.
57 #
58 #    Also, reading tkinter's source code typically won't help much because it
59 #    uses a lot of **kwargs and duck typing. Typically every argument goes into
60 #    self.tk.call, which is _tkinter.TkappType.call, and the return value is
61 #    whatever that returns. The type of that depends on how the Tcl interpreter
62 #    represents the return value of the executed Tcl code.
63 #
64 #  - If you think that int is an appropriate type for something, then you may
65 #    actually want _ScreenUnits instead.
66 #
67 #  - If you think that Callable[something] is an appropriate type for
68 #    something, then you may actually want Callable[something] | str,
69 #    because it's often possible to specify a string of Tcl code.
70 #
71 #  - If you think the correct type is Iterable[Foo] or Sequence[Foo], it is
72 #    probably list[Foo] | tuple[Foo, ...], disallowing other sequences such
73 #    as deques:
74 #
75 #        >>> tkinter.Label(font=('Helvetica', 12, collections.deque(['bold'])))
76 #        Traceback (most recent call last):
77 #          ...
78 #        _tkinter.TclError: unknown font style "deque(['bold'])"
79 #
80 #  - Some options can be set only in __init__, but all options are available
81 #    when getting their values with configure's return value or cget.
82 #
83 #  - Asks other tkinter users if you haven't worked much with tkinter.
84
85 # Some widgets have an option named -compound that accepts different values
86 # than the _Compound defined here. Many other options have similar things.
87 _Anchor = Literal["nw", "n", "ne", "w", "center", "e", "sw", "s", "se"]  # manual page: Tk_GetAnchor
88 _Bitmap = str  # manual page: Tk_GetBitmap
89 _ButtonCommand = Union[str, Callable[[], Any]]  # return value is returned from Button.invoke()
90 _CanvasItemId = int
91 _Color = str  # typically '#rrggbb', '#rgb' or color names.
92 _Compound = Literal["top", "left", "center", "right", "bottom", "none"]  # -compound in manual page named 'options'
93 _Cursor = Union[str, Tuple[str], Tuple[str, str], Tuple[str, str, str], Tuple[str, str, str, str]]  # manual page: Tk_GetCursor
94 _EntryValidateCommand = Union[
95     Callable[[], bool], str, List[str], Tuple[str, ...]
96 ]  # example when it's sequence:  entry['invalidcommand'] = [entry.register(print), '%P']
97 _GridIndex = Union[int, str, Literal["all"]]
98 _ImageSpec = Union[_Image, str]  # str can be from e.g. tkinter.image_names()
99 _Padding = Union[
100     _ScreenUnits,
101     Tuple[_ScreenUnits],
102     Tuple[_ScreenUnits, _ScreenUnits],
103     Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits],
104     Tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits],
105 ]
106 _Relief = Literal["raised", "sunken", "flat", "ridge", "solid", "groove"]  # manual page: Tk_GetRelief
107 _ScreenUnits = Union[str, float]  # manual page: Tk_GetPixels
108 _XYScrollCommand = Union[str, Callable[[float, float], Any]]  # -xscrollcommand and -yscrollcommand in 'options' manual page
109 _TakeFocusValue = Union[int, Literal[""], Callable[[str], Optional[bool]]]  # -takefocus in manual page named 'options'
110
111 class EventType(str, Enum):
112     Activate: str
113     ButtonPress: str
114     ButtonRelease: str
115     Circulate: str
116     CirculateRequest: str
117     ClientMessage: str
118     Colormap: str
119     Configure: str
120     ConfigureRequest: str
121     Create: str
122     Deactivate: str
123     Destroy: str
124     Enter: str
125     Expose: str
126     FocusIn: str
127     FocusOut: str
128     GraphicsExpose: str
129     Gravity: str
130     KeyPress: str
131     KeyRelease: str
132     Keymap: str
133     Leave: str
134     Map: str
135     MapRequest: str
136     Mapping: str
137     Motion: str
138     MouseWheel: str
139     NoExpose: str
140     Property: str
141     Reparent: str
142     ResizeRequest: str
143     Selection: str
144     SelectionClear: str
145     SelectionRequest: str
146     Unmap: str
147     VirtualEvent: str
148     Visibility: str
149
150 _W = TypeVar("_W", bound="Misc")
151 # Events considered covariant because you should never assign to event.widget.
152 _W_co = TypeVar("_W_co", covariant=True, bound="Misc")
153
154 class Event(Generic[_W_co]):
155     serial: int
156     num: int
157     focus: bool
158     height: int
159     width: int
160     keycode: int
161     state: int | str
162     time: int
163     x: int
164     y: int
165     x_root: int
166     y_root: int
167     char: str
168     send_event: bool
169     keysym: str
170     keysym_num: int
171     type: EventType
172     widget: _W_co
173     delta: int
174
175 def NoDefaultRoot(): ...
176
177 _TraceMode = Literal["array", "read", "write", "unset"]
178
179 class Variable:
180     def __init__(self, master: Misc | None = ..., value: Any | None = ..., name: str | None = ...) -> None: ...
181     def set(self, value: Any) -> None: ...
182     initialize = set
183     def get(self) -> Any: ...
184     def trace_add(self, mode: _TraceMode, callback: Callable[[str, str, str], Any]) -> str: ...
185     def trace_remove(self, mode: _TraceMode, cbname: str) -> None: ...
186     def trace_info(self) -> list[tuple[Tuple[_TraceMode, ...], str]]: ...
187     def trace_variable(self, mode, callback): ...  # deprecated
188     def trace_vdelete(self, mode, cbname): ...  # deprecated
189     def trace_vinfo(self): ...  # deprecated
190     trace = trace_variable  # deprecated
191
192 class StringVar(Variable):
193     def __init__(self, master: Misc | None = ..., value: str | None = ..., name: str | None = ...) -> None: ...
194     def set(self, value: str) -> None: ...
195     initialize = set
196     def get(self) -> str: ...
197
198 class IntVar(Variable):
199     def __init__(self, master: Misc | None = ..., value: int | None = ..., name: str | None = ...) -> None: ...
200     def set(self, value: int) -> None: ...
201     initialize = set
202     def get(self) -> int: ...
203
204 class DoubleVar(Variable):
205     def __init__(self, master: Misc | None = ..., value: float | None = ..., name: str | None = ...) -> None: ...
206     def set(self, value: float) -> None: ...
207     initialize = set
208     def get(self) -> float: ...
209
210 class BooleanVar(Variable):
211     def __init__(self, master: Misc | None = ..., value: bool | None = ..., name: str | None = ...) -> None: ...
212     def set(self, value: bool) -> None: ...
213     initialize = set
214     def get(self) -> bool: ...
215
216 def mainloop(n: int = ...) -> None: ...
217
218 getint: Any
219 getdouble: Any
220
221 def getboolean(s): ...
222
223 class _GridIndexInfo(TypedDict, total=False):
224     minsize: _ScreenUnits
225     pad: _ScreenUnits
226     uniform: str | None
227     weight: int
228
229 class Misc:
230     master: Misc | None
231     tk: _tkinter.TkappType
232     children: dict[str, Widget]
233     def destroy(self) -> None: ...
234     def deletecommand(self, name: str) -> None: ...
235     def tk_strictMotif(self, boolean: Any | None = ...): ...
236     def tk_bisque(self): ...
237     def tk_setPalette(self, *args, **kw): ...
238     def wait_variable(self, name: str | Variable = ...) -> None: ...
239     waitvar = wait_variable
240     def wait_window(self, window: Misc | None = ...) -> None: ...
241     def wait_visibility(self, window: Misc | None = ...) -> None: ...
242     def setvar(self, name: str = ..., value: str = ...): ...
243     def getvar(self, name: str = ...): ...
244     def getint(self, s): ...
245     def getdouble(self, s): ...
246     def getboolean(self, s): ...
247     def focus_set(self) -> None: ...
248     focus = focus_set
249     def focus_force(self) -> None: ...
250     def focus_get(self) -> Misc | None: ...
251     def focus_displayof(self) -> Misc | None: ...
252     def focus_lastfor(self) -> Misc | None: ...
253     def tk_focusFollowsMouse(self) -> None: ...
254     def tk_focusNext(self) -> Misc | None: ...
255     def tk_focusPrev(self) -> Misc | None: ...
256     @overload
257     def after(self, ms: int, func: None = ...) -> None: ...
258     @overload
259     def after(self, ms: int | Literal["idle"], func: Callable[..., Any], *args: Any) -> str: ...
260     # after_idle is essentially partialmethod(after, "idle")
261     def after_idle(self, func: Callable[..., Any], *args: Any) -> str: ...
262     def after_cancel(self, id: str) -> None: ...
263     def bell(self, displayof: Literal[0] | Misc | None = ...): ...
264     def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ...
265     def clipboard_clear(self, *, displayof: Misc = ...) -> None: ...
266     def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...): ...
267     def grab_current(self): ...
268     def grab_release(self): ...
269     def grab_set(self) -> None: ...
270     def grab_set_global(self) -> None: ...
271     def grab_status(self): ...
272     def option_add(self, pattern, value, priority: Any | None = ...): ...
273     def option_clear(self): ...
274     def option_get(self, name, className): ...
275     def option_readfile(self, fileName, priority: Any | None = ...): ...
276     def selection_clear(self, **kw): ...
277     def selection_get(self, **kw): ...
278     def selection_handle(self, command, **kw): ...
279     def selection_own(self, **kw): ...
280     def selection_own_get(self, **kw): ...
281     def send(self, interp, cmd, *args): ...
282     def lower(self, belowThis: Any | None = ...): ...
283     def tkraise(self, aboveThis: Any | None = ...): ...
284     lift = tkraise
285     def winfo_atom(self, name: str, displayof: Literal[0] | Misc | None = ...): ...
286     def winfo_atomname(self, id: int, displayof: Literal[0] | Misc | None = ...): ...
287     def winfo_cells(self) -> int: ...
288     def winfo_children(self) -> list[Widget]: ...  # Widget because it can't be Toplevel or Tk
289     def winfo_class(self) -> str: ...
290     def winfo_colormapfull(self) -> bool: ...
291     def winfo_containing(self, rootX: int, rootY: int, displayof: Literal[0] | Misc | None = ...) -> Misc | None: ...
292     def winfo_depth(self) -> int: ...
293     def winfo_exists(self) -> bool: ...
294     def winfo_fpixels(self, number: _ScreenUnits) -> float: ...
295     def winfo_geometry(self) -> str: ...
296     def winfo_height(self) -> int: ...
297     def winfo_id(self) -> int: ...
298     def winfo_interps(self, displayof: Literal[0] | Misc | None = ...) -> Tuple[str, ...]: ...
299     def winfo_ismapped(self) -> bool: ...
300     def winfo_manager(self) -> str: ...
301     def winfo_name(self) -> str: ...
302     def winfo_parent(self) -> str: ...  # return value needs nametowidget()
303     def winfo_pathname(self, id: int, displayof: Literal[0] | Misc | None = ...): ...
304     def winfo_pixels(self, number: _ScreenUnits) -> int: ...
305     def winfo_pointerx(self) -> int: ...
306     def winfo_pointerxy(self) -> tuple[int, int]: ...
307     def winfo_pointery(self) -> int: ...
308     def winfo_reqheight(self) -> int: ...
309     def winfo_reqwidth(self) -> int: ...
310     def winfo_rgb(self, color: _Color) -> tuple[int, int, int]: ...
311     def winfo_rootx(self) -> int: ...
312     def winfo_rooty(self) -> int: ...
313     def winfo_screen(self) -> str: ...
314     def winfo_screencells(self) -> int: ...
315     def winfo_screendepth(self) -> int: ...
316     def winfo_screenheight(self) -> int: ...
317     def winfo_screenmmheight(self) -> int: ...
318     def winfo_screenmmwidth(self) -> int: ...
319     def winfo_screenvisual(self) -> str: ...
320     def winfo_screenwidth(self) -> int: ...
321     def winfo_server(self) -> str: ...
322     def winfo_toplevel(self) -> Tk | Toplevel: ...
323     def winfo_viewable(self) -> bool: ...
324     def winfo_visual(self) -> str: ...
325     def winfo_visualid(self) -> str: ...
326     def winfo_visualsavailable(self, includeids: int = ...) -> list[tuple[str, int]]: ...
327     def winfo_vrootheight(self) -> int: ...
328     def winfo_vrootwidth(self) -> int: ...
329     def winfo_vrootx(self) -> int: ...
330     def winfo_vrooty(self) -> int: ...
331     def winfo_width(self) -> int: ...
332     def winfo_x(self) -> int: ...
333     def winfo_y(self) -> int: ...
334     def update(self) -> None: ...
335     def update_idletasks(self) -> None: ...
336     def bindtags(self, tagList: Any | None = ...): ...
337     # bind with isinstance(func, str) doesn't return anything, but all other
338     # binds do. The default value of func is not str.
339     @overload
340     def bind(
341         self,
342         sequence: str | None = ...,
343         func: Callable[[Event[Misc]], Any] | None = ...,
344         add: Literal["", "+"] | bool | None = ...,
345     ) -> str: ...
346     @overload
347     def bind(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
348     @overload
349     def bind(self, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
350     # There's no way to know what type of widget bind_all and bind_class
351     # callbacks will get, so those are Misc.
352     @overload
353     def bind_all(
354         self,
355         sequence: str | None = ...,
356         func: Callable[[Event[Misc]], Any] | None = ...,
357         add: Literal["", "+"] | bool | None = ...,
358     ) -> str: ...
359     @overload
360     def bind_all(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
361     @overload
362     def bind_all(self, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
363     @overload
364     def bind_class(
365         self,
366         className: str,
367         sequence: str | None = ...,
368         func: Callable[[Event[Misc]], Any] | None = ...,
369         add: Literal["", "+"] | bool | None = ...,
370     ) -> str: ...
371     @overload
372     def bind_class(self, className: str, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
373     @overload
374     def bind_class(self, className: str, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
375     def unbind(self, sequence: str, funcid: str | None = ...) -> None: ...
376     def unbind_all(self, sequence: str) -> None: ...
377     def unbind_class(self, className: str, sequence: str) -> None: ...
378     def mainloop(self, n: int = ...) -> None: ...
379     def quit(self): ...
380     def nametowidget(self, name: str | Misc | _tkinter.Tcl_Obj) -> Any: ...
381     def register(
382         self, func: Callable[..., Any], subst: Callable[..., Sequence[Any]] | None = ..., needcleanup: int = ...
383     ) -> str: ...
384     def keys(self) -> list[str]: ...
385     @overload
386     def pack_propagate(self, flag: bool) -> bool | None: ...
387     @overload
388     def pack_propagate(self) -> None: ...
389     propagate = pack_propagate
390     def grid_anchor(self, anchor: _Anchor | None = ...) -> None: ...
391     anchor = grid_anchor
392     @overload
393     def grid_bbox(
394         self, column: None = ..., row: None = ..., col2: None = ..., row2: None = ...
395     ) -> tuple[int, int, int, int] | None: ...
396     @overload
397     def grid_bbox(self, column: int, row: int, col2: None = ..., row2: None = ...) -> tuple[int, int, int, int] | None: ...
398     @overload
399     def grid_bbox(self, column: int, row: int, col2: int, row2: int) -> tuple[int, int, int, int] | None: ...
400     bbox = grid_bbox
401     def grid_columnconfigure(
402         self,
403         index: _GridIndex,
404         cnf: _GridIndexInfo = ...,
405         *,
406         minsize: _ScreenUnits = ...,
407         pad: _ScreenUnits = ...,
408         uniform: str = ...,
409         weight: int = ...,
410     ) -> _GridIndexInfo | Any: ...  # can be None but annoying to check
411     def grid_rowconfigure(
412         self,
413         index: _GridIndex,
414         cnf: _GridIndexInfo = ...,
415         *,
416         minsize: _ScreenUnits = ...,
417         pad: _ScreenUnits = ...,
418         uniform: str = ...,
419         weight: int = ...,
420     ) -> _GridIndexInfo | Any: ...  # can be None but annoying to check
421     columnconfigure = grid_columnconfigure
422     rowconfigure = grid_rowconfigure
423     def grid_location(self, x: _ScreenUnits, y: _ScreenUnits) -> tuple[int, int]: ...
424     @overload
425     def grid_propagate(self, flag: bool) -> None: ...
426     @overload
427     def grid_propagate(self) -> bool: ...
428     def grid_size(self) -> tuple[int, int]: ...
429     size = grid_size
430     # Widget because Toplevel or Tk is never a slave
431     def pack_slaves(self) -> list[Widget]: ...
432     def grid_slaves(self, row: int | None = ..., column: int | None = ...) -> list[Widget]: ...
433     def place_slaves(self) -> list[Widget]: ...
434     slaves = pack_slaves
435     def event_add(self, virtual: str, *sequences: str) -> None: ...
436     def event_delete(self, virtual: str, *sequences: str) -> None: ...
437     def event_generate(
438         self,
439         sequence: str,
440         *,
441         above: Misc | int = ...,
442         borderwidth: _ScreenUnits = ...,
443         button: int = ...,
444         count: int = ...,
445         data: Any = ...,  # anything with usable str() value
446         delta: int = ...,
447         detail: str = ...,
448         focus: bool = ...,
449         height: _ScreenUnits = ...,
450         keycode: int = ...,
451         keysym: str = ...,
452         mode: str = ...,
453         override: bool = ...,
454         place: Literal["PlaceOnTop", "PlaceOnBottom"] = ...,
455         root: Misc | int = ...,
456         rootx: _ScreenUnits = ...,
457         rooty: _ScreenUnits = ...,
458         sendevent: bool = ...,
459         serial: int = ...,
460         state: int | str = ...,
461         subwindow: Misc | int = ...,
462         time: int = ...,
463         warp: bool = ...,
464         width: _ScreenUnits = ...,
465         when: Literal["now", "tail", "head", "mark"] = ...,
466         x: _ScreenUnits = ...,
467         y: _ScreenUnits = ...,
468     ) -> None: ...
469     def event_info(self, virtual: str | None = ...) -> Tuple[str, ...]: ...
470     def image_names(self) -> Tuple[str, ...]: ...
471     def image_types(self) -> Tuple[str, ...]: ...
472     # See #4363 and #4891
473     def __setitem__(self, key: str, value: Any) -> None: ...
474     def __getitem__(self, key: str) -> Any: ...
475     def cget(self, key: str) -> Any: ...
476     def configure(self, cnf: Any = ...) -> Any: ...
477     # TODO: config is an alias of configure, but adding that here creates lots of mypy errors
478
479 class CallWrapper:
480     func: Any
481     subst: Any
482     widget: Any
483     def __init__(self, func, subst, widget): ...
484     def __call__(self, *args): ...
485
486 class XView:
487     @overload
488     def xview(self) -> tuple[float, float]: ...
489     @overload
490     def xview(self, *args: Any) -> Any: ...
491     def xview_moveto(self, fraction: float) -> None: ...
492     @overload
493     def xview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ...
494     @overload
495     def xview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ...
496
497 class YView:
498     @overload
499     def yview(self) -> tuple[float, float]: ...
500     @overload
501     def yview(self, *args: Any) -> Any: ...
502     def yview_moveto(self, fraction: float) -> None: ...
503     @overload
504     def yview_scroll(self, number: int, what: Literal["units", "pages"]) -> None: ...
505     @overload
506     def yview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ...
507
508 class Wm:
509     @overload
510     def wm_aspect(self, minNumer: int, minDenom: int, maxNumer: int, maxDenom: int) -> None: ...
511     @overload
512     def wm_aspect(
513         self, minNumer: None = ..., minDenom: None = ..., maxNumer: None = ..., maxDenom: None = ...
514     ) -> tuple[int, int, int, int] | None: ...
515     aspect = wm_aspect
516     @overload
517     def wm_attributes(self) -> Tuple[Any, ...]: ...
518     @overload
519     def wm_attributes(self, __option: str) -> Any: ...
520     @overload
521     def wm_attributes(self, __option: str, __value: Any, *__other_option_value_pairs: Any) -> None: ...
522     attributes = wm_attributes
523     def wm_client(self, name: str | None = ...) -> str: ...
524     client = wm_client
525     @overload
526     def wm_colormapwindows(self) -> list[Misc]: ...
527     @overload
528     def wm_colormapwindows(self, __wlist: list[Misc] | Tuple[Misc, ...]) -> None: ...
529     @overload
530     def wm_colormapwindows(self, __first_wlist_item: Misc, *other_wlist_items: Misc) -> None: ...
531     colormapwindows = wm_colormapwindows
532     def wm_command(self, value: str | None = ...) -> str: ...
533     command = wm_command
534     # Some of these always return empty string, but return type is set to None to prevent accidentally using it
535     def wm_deiconify(self) -> None: ...
536     deiconify = wm_deiconify
537     def wm_focusmodel(self, model: Any | None = ...): ...
538     focusmodel = wm_focusmodel
539     def wm_forget(self, window: Wm) -> None: ...
540     forget = wm_forget
541     def wm_frame(self): ...
542     frame = wm_frame
543     @overload
544     def wm_geometry(self, newGeometry: None = ...) -> str: ...
545     @overload
546     def wm_geometry(self, newGeometry: str) -> None: ...
547     geometry = wm_geometry
548     def wm_grid(
549         self, baseWidth: Any | None = ..., baseHeight: Any | None = ..., widthInc: Any | None = ..., heightInc: Any | None = ...
550     ): ...
551     grid = wm_grid
552     def wm_group(self, pathName: Any | None = ...): ...
553     group = wm_group
554     def wm_iconbitmap(self, bitmap: Any | None = ..., default: Any | None = ...): ...
555     iconbitmap = wm_iconbitmap
556     def wm_iconify(self) -> None: ...
557     iconify = wm_iconify
558     def wm_iconmask(self, bitmap: Any | None = ...): ...
559     iconmask = wm_iconmask
560     def wm_iconname(self, newName: Any | None = ...): ...
561     iconname = wm_iconname
562     def wm_iconphoto(self, default: bool, __image1: Image, *args: Image) -> None: ...
563     iconphoto = wm_iconphoto
564     def wm_iconposition(self, x: Any | None = ..., y: Any | None = ...): ...
565     iconposition = wm_iconposition
566     def wm_iconwindow(self, pathName: Any | None = ...): ...
567     iconwindow = wm_iconwindow
568     def wm_manage(self, widget): ...
569     manage = wm_manage
570     @overload
571     def wm_maxsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ...
572     @overload
573     def wm_maxsize(self, width: int, height: int) -> None: ...
574     maxsize = wm_maxsize
575     @overload
576     def wm_minsize(self, width: None = ..., height: None = ...) -> tuple[int, int]: ...
577     @overload
578     def wm_minsize(self, width: int, height: int) -> None: ...
579     minsize = wm_minsize
580     @overload
581     def wm_overrideredirect(self, boolean: None = ...) -> bool | None: ...  # returns True or None
582     @overload
583     def wm_overrideredirect(self, boolean: bool) -> None: ...
584     overrideredirect = wm_overrideredirect
585     def wm_positionfrom(self, who: Any | None = ...): ...
586     positionfrom = wm_positionfrom
587     @overload
588     def wm_protocol(self, name: str, func: Callable[[], Any] | str) -> None: ...
589     @overload
590     def wm_protocol(self, name: str, func: None = ...) -> str: ...
591     @overload
592     def wm_protocol(self, name: None = ..., func: None = ...) -> Tuple[str, ...]: ...
593     protocol = wm_protocol
594     @overload
595     def wm_resizable(self, width: None = ..., height: None = ...) -> tuple[bool, bool]: ...
596     @overload
597     def wm_resizable(self, width: bool, height: bool) -> None: ...
598     resizable = wm_resizable
599     def wm_sizefrom(self, who: Any | None = ...): ...
600     sizefrom = wm_sizefrom
601     @overload
602     def wm_state(self, newstate: None = ...) -> str: ...
603     @overload
604     def wm_state(self, newstate: str) -> None: ...
605     state = wm_state
606     @overload
607     def wm_title(self, string: None = ...) -> str: ...
608     @overload
609     def wm_title(self, string: str) -> None: ...
610     title = wm_title
611     @overload
612     def wm_transient(self, master: None = ...) -> _tkinter.Tcl_Obj: ...
613     @overload
614     def wm_transient(self, master: Wm | _tkinter.Tcl_Obj) -> None: ...
615     transient = wm_transient
616     def wm_withdraw(self) -> None: ...
617     withdraw = wm_withdraw
618
619 class _ExceptionReportingCallback(Protocol):
620     def __call__(self, __exc: Type[BaseException], __val: BaseException, __tb: TracebackType | None) -> Any: ...
621
622 class Tk(Misc, Wm):
623     master: None
624     def __init__(
625         # please update ttkthemes stub if you change this
626         self,
627         screenName: str | None = ...,
628         baseName: str | None = ...,
629         className: str = ...,
630         useTk: bool = ...,
631         sync: bool = ...,
632         use: str | None = ...,
633     ) -> None: ...
634     @overload
635     def configure(
636         self,
637         cnf: dict[str, Any] | None = ...,
638         *,
639         background: _Color = ...,
640         bd: _ScreenUnits = ...,
641         bg: _Color = ...,
642         border: _ScreenUnits = ...,
643         borderwidth: _ScreenUnits = ...,
644         cursor: _Cursor = ...,
645         height: _ScreenUnits = ...,
646         highlightbackground: _Color = ...,
647         highlightcolor: _Color = ...,
648         highlightthickness: _ScreenUnits = ...,
649         menu: Menu = ...,
650         padx: _ScreenUnits = ...,
651         pady: _ScreenUnits = ...,
652         relief: _Relief = ...,
653         takefocus: _TakeFocusValue = ...,
654         width: _ScreenUnits = ...,
655     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
656     @overload
657     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
658     config = configure
659     def loadtk(self) -> None: ...  # differs from _tkinter.TkappType.loadtk
660     def destroy(self) -> None: ...
661     def readprofile(self, baseName: str, className: str) -> None: ...
662     report_callback_exception: _ExceptionReportingCallback
663     # Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo
664     # Please keep in sync with _tkinter.TkappType
665     call: Callable[..., Any]
666     def eval(self, __code: str) -> str: ...
667     adderrorinfo: Any
668     createcommand: Any
669     createfilehandler: Any
670     createtimerhandler: Any
671     deletecommand: Any
672     deletefilehandler: Any
673     dooneevent: Any
674     evalfile: Any
675     exprboolean: Any
676     exprdouble: Any
677     exprlong: Any
678     exprstring: Any
679     getboolean: Any
680     getdouble: Any
681     getint: Any
682     getvar: Any
683     globalgetvar: Any
684     globalsetvar: Any
685     globalunsetvar: Any
686     interpaddr: Any
687     mainloop: Any
688     quit: Any
689     record: Any
690     setvar: Any
691     split: Any
692     splitlist: Any
693     unsetvar: Any
694     wantobjects: Any
695     willdispatch: Any
696
697 def Tcl(screenName: Any | None = ..., baseName: Any | None = ..., className: str = ..., useTk: bool = ...): ...
698
699 _InMiscTotal = TypedDict("_InMiscTotal", {"in": Misc})
700 _InMiscNonTotal = TypedDict("_InMiscNonTotal", {"in": Misc}, total=False)
701
702 class _PackInfo(_InMiscTotal):
703     # 'before' and 'after' never appear in _PackInfo
704     anchor: _Anchor
705     expand: bool
706     fill: Literal["none", "x", "y", "both"]
707     side: Literal["left", "right", "top", "bottom"]
708     # Paddings come out as int or tuple of int, even though any _ScreenUnits
709     # can be specified in pack().
710     ipadx: int
711     ipady: int
712     padx: int | tuple[int, int]
713     pady: int | tuple[int, int]
714
715 class Pack:
716     # _PackInfo is not the valid type for cnf because pad stuff accepts any
717     # _ScreenUnits instead of int only. I didn't bother to create another
718     # TypedDict for cnf because it appears to be a legacy thing that was
719     # replaced by **kwargs.
720     def pack_configure(
721         self,
722         cnf: Mapping[str, Any] | None = ...,
723         *,
724         after: Misc = ...,
725         anchor: _Anchor = ...,
726         before: Misc = ...,
727         expand: int = ...,
728         fill: Literal["none", "x", "y", "both"] = ...,
729         side: Literal["left", "right", "top", "bottom"] = ...,
730         ipadx: _ScreenUnits = ...,
731         ipady: _ScreenUnits = ...,
732         padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ...,
733         pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ...,
734         in_: Misc = ...,
735         **kw: Any,  # allow keyword argument named 'in', see #4836
736     ) -> None: ...
737     def pack_forget(self) -> None: ...
738     def pack_info(self) -> _PackInfo: ...  # errors if widget hasn't been packed
739     pack = pack_configure
740     forget = pack_forget
741     propagate = Misc.pack_propagate
742     # commented out to avoid mypy getting confused with multiple
743     # inheritance and how things get overridden with different things
744     # info = pack_info
745     # pack_propagate = Misc.pack_propagate
746     # configure = pack_configure
747     # config = pack_configure
748     # slaves = Misc.pack_slaves
749     # pack_slaves = Misc.pack_slaves
750
751 class _PlaceInfo(_InMiscNonTotal):  # empty dict if widget hasn't been placed
752     anchor: _Anchor
753     bordermode: Literal["inside", "outside", "ignore"]
754     width: str  # can be int()ed (even after e.g. widget.place(height='2.3c') or similar)
755     height: str  # can be int()ed
756     x: str  # can be int()ed
757     y: str  # can be int()ed
758     relheight: str  # can be float()ed if not empty string
759     relwidth: str  # can be float()ed if not empty string
760     relx: str  # can be float()ed if not empty string
761     rely: str  # can be float()ed if not empty string
762
763 class Place:
764     def place_configure(
765         self,
766         cnf: Mapping[str, Any] | None = ...,
767         *,
768         anchor: _Anchor = ...,
769         bordermode: Literal["inside", "outside", "ignore"] = ...,
770         width: _ScreenUnits = ...,
771         height: _ScreenUnits = ...,
772         x: _ScreenUnits = ...,
773         y: _ScreenUnits = ...,
774         # str allowed for compatibility with place_info()
775         relheight: str | float = ...,
776         relwidth: str | float = ...,
777         relx: str | float = ...,
778         rely: str | float = ...,
779         in_: Misc = ...,
780         **kw: Any,  # allow keyword argument named 'in', see #4836
781     ) -> None: ...
782     def place_forget(self) -> None: ...
783     def place_info(self) -> _PlaceInfo: ...
784     place = place_configure
785     info = place_info
786     # commented out to avoid mypy getting confused with multiple
787     # inheritance and how things get overridden with different things
788     # config = place_configure
789     # configure = place_configure
790     # forget = place_forget
791     # slaves = Misc.place_slaves
792     # place_slaves = Misc.place_slaves
793
794 class _GridInfo(_InMiscNonTotal):  # empty dict if widget hasn't been gridded
795     column: int
796     columnspan: int
797     row: int
798     rowspan: int
799     ipadx: int
800     ipady: int
801     padx: int | tuple[int, int]
802     pady: int | tuple[int, int]
803     sticky: str  # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty
804
805 class Grid:
806     def grid_configure(
807         self,
808         cnf: Mapping[str, Any] | None = ...,
809         *,
810         column: int = ...,
811         columnspan: int = ...,
812         row: int = ...,
813         rowspan: int = ...,
814         ipadx: _ScreenUnits = ...,
815         ipady: _ScreenUnits = ...,
816         padx: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ...,
817         pady: _ScreenUnits | tuple[_ScreenUnits, _ScreenUnits] = ...,
818         sticky: str = ...,  # consists of letters 'n', 's', 'w', 'e', may contain repeats, may be empty
819         in_: Misc = ...,
820         **kw: Any,  # allow keyword argument named 'in', see #4836
821     ) -> None: ...
822     def grid_forget(self) -> None: ...
823     def grid_remove(self) -> None: ...
824     def grid_info(self) -> _GridInfo: ...
825     grid = grid_configure
826     location = Misc.grid_location
827     size = Misc.grid_size
828     # commented out to avoid mypy getting confused with multiple
829     # inheritance and how things get overridden with different things
830     # bbox = Misc.grid_bbox
831     # grid_bbox = Misc.grid_bbox
832     # forget = grid_forget
833     # info = grid_info
834     # grid_location = Misc.grid_location
835     # grid_propagate = Misc.grid_propagate
836     # grid_size = Misc.grid_size
837     # rowconfigure = Misc.grid_rowconfigure
838     # grid_rowconfigure = Misc.grid_rowconfigure
839     # grid_columnconfigure = Misc.grid_columnconfigure
840     # columnconfigure = Misc.grid_columnconfigure
841     # config = grid_configure
842     # configure = grid_configure
843     # propagate = Misc.grid_propagate
844     # slaves = Misc.grid_slaves
845     # grid_slaves = Misc.grid_slaves
846
847 class BaseWidget(Misc):
848     master: Misc
849     widgetName: Any
850     def __init__(self, master, widgetName, cnf=..., kw=..., extra=...): ...
851     def destroy(self) -> None: ...
852
853 # This class represents any widget except Toplevel or Tk.
854 class Widget(BaseWidget, Pack, Place, Grid):
855     # Allow bind callbacks to take e.g. Event[Label] instead of Event[Misc].
856     # Tk and Toplevel get notified for their child widgets' events, but other
857     # widgets don't.
858     @overload
859     def bind(
860         self: _W,
861         sequence: str | None = ...,
862         func: Callable[[Event[_W]], Any] | None = ...,
863         add: Literal["", "+"] | bool | None = ...,
864     ) -> str: ...
865     @overload
866     def bind(self, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
867     @overload
868     def bind(self, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
869
870 class Toplevel(BaseWidget, Wm):
871     # Toplevel and Tk have the same options because they correspond to the same
872     # Tcl/Tk toplevel widget. For some reason, config and configure must be
873     # copy/pasted here instead of aliasing as 'config = Tk.config'.
874     def __init__(
875         self,
876         master: Misc | None = ...,
877         cnf: dict[str, Any] | None = ...,
878         *,
879         background: _Color = ...,
880         bd: _ScreenUnits = ...,
881         bg: _Color = ...,
882         border: _ScreenUnits = ...,
883         borderwidth: _ScreenUnits = ...,
884         class_: str = ...,
885         colormap: Literal["new", ""] | Misc = ...,
886         container: bool = ...,
887         cursor: _Cursor = ...,
888         height: _ScreenUnits = ...,
889         highlightbackground: _Color = ...,
890         highlightcolor: _Color = ...,
891         highlightthickness: _ScreenUnits = ...,
892         menu: Menu = ...,
893         name: str = ...,
894         padx: _ScreenUnits = ...,
895         pady: _ScreenUnits = ...,
896         relief: _Relief = ...,
897         screen: str = ...,  # can't be changed after creating widget
898         takefocus: _TakeFocusValue = ...,
899         use: int = ...,
900         visual: str | tuple[str, int] = ...,
901         width: _ScreenUnits = ...,
902     ) -> None: ...
903     @overload
904     def configure(
905         self,
906         cnf: dict[str, Any] | None = ...,
907         *,
908         background: _Color = ...,
909         bd: _ScreenUnits = ...,
910         bg: _Color = ...,
911         border: _ScreenUnits = ...,
912         borderwidth: _ScreenUnits = ...,
913         cursor: _Cursor = ...,
914         height: _ScreenUnits = ...,
915         highlightbackground: _Color = ...,
916         highlightcolor: _Color = ...,
917         highlightthickness: _ScreenUnits = ...,
918         menu: Menu = ...,
919         padx: _ScreenUnits = ...,
920         pady: _ScreenUnits = ...,
921         relief: _Relief = ...,
922         takefocus: _TakeFocusValue = ...,
923         width: _ScreenUnits = ...,
924     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
925     @overload
926     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
927     config = configure
928
929 class Button(Widget):
930     def __init__(
931         self,
932         master: Misc | None = ...,
933         cnf: dict[str, Any] | None = ...,
934         *,
935         activebackground: _Color = ...,
936         activeforeground: _Color = ...,
937         anchor: _Anchor = ...,
938         background: _Color = ...,
939         bd: _ScreenUnits = ...,  # same as borderwidth
940         bg: _Color = ...,  # same as background
941         bitmap: _Bitmap = ...,
942         border: _ScreenUnits = ...,  # same as borderwidth
943         borderwidth: _ScreenUnits = ...,
944         command: _ButtonCommand = ...,
945         compound: _Compound = ...,
946         cursor: _Cursor = ...,
947         default: Literal["normal", "active", "disabled"] = ...,
948         disabledforeground: _Color = ...,
949         fg: _Color = ...,  # same as foreground
950         font: _FontDescription = ...,
951         foreground: _Color = ...,
952         # width and height must be int for buttons containing just text, but
953         # ints are also valid _ScreenUnits
954         height: _ScreenUnits = ...,
955         highlightbackground: _Color = ...,
956         highlightcolor: _Color = ...,
957         highlightthickness: _ScreenUnits = ...,
958         image: _ImageSpec = ...,
959         justify: Literal["left", "center", "right"] = ...,
960         name: str = ...,
961         overrelief: _Relief = ...,
962         padx: _ScreenUnits = ...,
963         pady: _ScreenUnits = ...,
964         relief: _Relief = ...,
965         repeatdelay: int = ...,
966         repeatinterval: int = ...,
967         state: Literal["normal", "active", "disabled"] = ...,
968         takefocus: _TakeFocusValue = ...,
969         text: float | str = ...,
970         # We allow the textvariable to be any Variable, not necessarily
971         # StringVar. This is useful for e.g. a button that displays the value
972         # of an IntVar.
973         textvariable: Variable = ...,
974         underline: int = ...,
975         width: _ScreenUnits = ...,
976         wraplength: _ScreenUnits = ...,
977     ) -> None: ...
978     @overload
979     def configure(
980         self,
981         cnf: dict[str, Any] | None = ...,
982         *,
983         activebackground: _Color = ...,
984         activeforeground: _Color = ...,
985         anchor: _Anchor = ...,
986         background: _Color = ...,
987         bd: _ScreenUnits = ...,
988         bg: _Color = ...,
989         bitmap: _Bitmap = ...,
990         border: _ScreenUnits = ...,
991         borderwidth: _ScreenUnits = ...,
992         command: _ButtonCommand = ...,
993         compound: _Compound = ...,
994         cursor: _Cursor = ...,
995         default: Literal["normal", "active", "disabled"] = ...,
996         disabledforeground: _Color = ...,
997         fg: _Color = ...,
998         font: _FontDescription = ...,
999         foreground: _Color = ...,
1000         height: _ScreenUnits = ...,
1001         highlightbackground: _Color = ...,
1002         highlightcolor: _Color = ...,
1003         highlightthickness: _ScreenUnits = ...,
1004         image: _ImageSpec = ...,
1005         justify: Literal["left", "center", "right"] = ...,
1006         overrelief: _Relief = ...,
1007         padx: _ScreenUnits = ...,
1008         pady: _ScreenUnits = ...,
1009         relief: _Relief = ...,
1010         repeatdelay: int = ...,
1011         repeatinterval: int = ...,
1012         state: Literal["normal", "active", "disabled"] = ...,
1013         takefocus: _TakeFocusValue = ...,
1014         text: float | str = ...,
1015         textvariable: Variable = ...,
1016         underline: int = ...,
1017         width: _ScreenUnits = ...,
1018         wraplength: _ScreenUnits = ...,
1019     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
1020     @overload
1021     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
1022     config = configure
1023     def flash(self): ...
1024     def invoke(self) -> Any: ...
1025
1026 class Canvas(Widget, XView, YView):
1027     def __init__(
1028         self,
1029         master: Misc | None = ...,
1030         cnf: dict[str, Any] | None = ...,
1031         *,
1032         background: _Color = ...,
1033         bd: _ScreenUnits = ...,
1034         bg: _Color = ...,
1035         border: _ScreenUnits = ...,
1036         borderwidth: _ScreenUnits = ...,
1037         closeenough: float = ...,
1038         confine: bool = ...,
1039         cursor: _Cursor = ...,
1040         # canvas manual page has a section named COORDINATES, and the first
1041         # part of it describes _ScreenUnits.
1042         height: _ScreenUnits = ...,
1043         highlightbackground: _Color = ...,
1044         highlightcolor: _Color = ...,
1045         highlightthickness: _ScreenUnits = ...,
1046         insertbackground: _Color = ...,
1047         insertborderwidth: _ScreenUnits = ...,
1048         insertofftime: int = ...,
1049         insertontime: int = ...,
1050         insertwidth: _ScreenUnits = ...,
1051         name: str = ...,
1052         offset: Any = ...,  # undocumented
1053         relief: _Relief = ...,
1054         # Setting scrollregion to None doesn't reset it back to empty,
1055         # but setting it to () does.
1056         scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = ...,
1057         selectbackground: _Color = ...,
1058         selectborderwidth: _ScreenUnits = ...,
1059         selectforeground: _Color = ...,
1060         # man page says that state can be 'hidden', but it can't
1061         state: Literal["normal", "disabled"] = ...,
1062         takefocus: _TakeFocusValue = ...,
1063         width: _ScreenUnits = ...,
1064         xscrollcommand: _XYScrollCommand = ...,
1065         xscrollincrement: _ScreenUnits = ...,
1066         yscrollcommand: _XYScrollCommand = ...,
1067         yscrollincrement: _ScreenUnits = ...,
1068     ) -> None: ...
1069     @overload
1070     def configure(
1071         self,
1072         cnf: dict[str, Any] | None = ...,
1073         *,
1074         background: _Color = ...,
1075         bd: _ScreenUnits = ...,
1076         bg: _Color = ...,
1077         border: _ScreenUnits = ...,
1078         borderwidth: _ScreenUnits = ...,
1079         closeenough: float = ...,
1080         confine: bool = ...,
1081         cursor: _Cursor = ...,
1082         height: _ScreenUnits = ...,
1083         highlightbackground: _Color = ...,
1084         highlightcolor: _Color = ...,
1085         highlightthickness: _ScreenUnits = ...,
1086         insertbackground: _Color = ...,
1087         insertborderwidth: _ScreenUnits = ...,
1088         insertofftime: int = ...,
1089         insertontime: int = ...,
1090         insertwidth: _ScreenUnits = ...,
1091         offset: Any = ...,  # undocumented
1092         relief: _Relief = ...,
1093         scrollregion: tuple[_ScreenUnits, _ScreenUnits, _ScreenUnits, _ScreenUnits] | tuple[()] = ...,
1094         selectbackground: _Color = ...,
1095         selectborderwidth: _ScreenUnits = ...,
1096         selectforeground: _Color = ...,
1097         state: Literal["normal", "disabled"] = ...,
1098         takefocus: _TakeFocusValue = ...,
1099         width: _ScreenUnits = ...,
1100         xscrollcommand: _XYScrollCommand = ...,
1101         xscrollincrement: _ScreenUnits = ...,
1102         yscrollcommand: _XYScrollCommand = ...,
1103         yscrollincrement: _ScreenUnits = ...,
1104     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
1105     @overload
1106     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
1107     config = configure
1108     def addtag(self, *args): ...  # internal method
1109     def addtag_above(self, newtag: str, tagOrId: str | _CanvasItemId) -> None: ...
1110     def addtag_all(self, newtag: str) -> None: ...
1111     def addtag_below(self, newtag: str, tagOrId: str | _CanvasItemId) -> None: ...
1112     def addtag_closest(
1113         self,
1114         newtag: str,
1115         x: _ScreenUnits,
1116         y: _ScreenUnits,
1117         halo: _ScreenUnits | None = ...,
1118         start: str | _CanvasItemId | None = ...,
1119     ) -> None: ...
1120     def addtag_enclosed(self, newtag: str, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> None: ...
1121     def addtag_overlapping(self, newtag: str, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits) -> None: ...
1122     def addtag_withtag(self, newtag: str, tagOrId: str | _CanvasItemId) -> None: ...
1123     def find(self, *args): ...  # internal method
1124     def find_above(self, tagOrId: str | _CanvasItemId) -> Tuple[_CanvasItemId, ...]: ...
1125     def find_all(self) -> Tuple[_CanvasItemId, ...]: ...
1126     def find_below(self, tagOrId: str | _CanvasItemId) -> Tuple[_CanvasItemId, ...]: ...
1127     def find_closest(
1128         self, x: _ScreenUnits, y: _ScreenUnits, halo: _ScreenUnits | None = ..., start: str | _CanvasItemId | None = ...
1129     ) -> Tuple[_CanvasItemId, ...]: ...
1130     def find_enclosed(
1131         self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: _ScreenUnits
1132     ) -> Tuple[_CanvasItemId, ...]: ...
1133     def find_overlapping(self, x1: _ScreenUnits, y1: _ScreenUnits, x2: _ScreenUnits, y2: float) -> Tuple[_CanvasItemId, ...]: ...
1134     def find_withtag(self, tagOrId: str | _CanvasItemId) -> Tuple[_CanvasItemId, ...]: ...
1135     # Canvas.bbox() args are `str | _CanvasItemId`, but mypy rejects that
1136     # description because it's incompatible with Misc.bbox(), an alias for
1137     # Misc.grid_bbox(). Yes it is, but there's not much we can do about it.
1138     def bbox(self, *args: str | _CanvasItemId) -> tuple[int, int, int, int]: ...  # type: ignore
1139     @overload
1140     def tag_bind(
1141         self,
1142         tagOrId: str | int,
1143         sequence: str | None = ...,
1144         func: Callable[[Event[Canvas]], Any] | None = ...,
1145         add: Literal["", "+"] | bool | None = ...,
1146     ) -> str: ...
1147     @overload
1148     def tag_bind(
1149         self, tagOrId: str | int, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...
1150     ) -> None: ...
1151     @overload
1152     def tag_bind(self, tagOrId: str | int, *, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
1153     def tag_unbind(self, tagOrId: str | int, sequence: str, funcid: str | None = ...) -> None: ...
1154     def canvasx(self, screenx, gridspacing: Any | None = ...): ...
1155     def canvasy(self, screeny, gridspacing: Any | None = ...): ...
1156     @overload
1157     def coords(self) -> list[float]: ...
1158     @overload
1159     def coords(self, __args: list[int] | list[float] | Tuple[float, ...]) -> None: ...
1160     @overload
1161     def coords(self, __x1: float, __y1: float, *args: float) -> None: ...
1162     # create_foo() methods accept coords as a list, a tuple, or as separate arguments.
1163     # Keyword arguments should be the same in each pair of overloads.
1164     def create_arc(self, *args, **kw) -> _CanvasItemId: ...
1165     def create_bitmap(self, *args, **kw) -> _CanvasItemId: ...
1166     def create_image(self, *args, **kw) -> _CanvasItemId: ...
1167     @overload
1168     def create_line(
1169         self,
1170         __x0: float,
1171         __y0: float,
1172         __x1: float,
1173         __y1: float,
1174         *,
1175         activedash: str | list[int] | Tuple[int, ...] = ...,
1176         activefill: _Color = ...,
1177         activestipple: str = ...,
1178         activewidth: _ScreenUnits = ...,
1179         arrow: Literal["first", "last", "both"] = ...,
1180         arrowshape: tuple[float, float, float] = ...,
1181         capstyle: Literal["round", "projecting", "butt"] = ...,
1182         dash: str | list[int] | Tuple[int, ...] = ...,
1183         dashoffset: _ScreenUnits = ...,
1184         disableddash: str | list[int] | Tuple[int, ...] = ...,
1185         disabledfill: _Color = ...,
1186         disabledstipple: _Bitmap = ...,
1187         disabledwidth: _ScreenUnits = ...,
1188         fill: _Color = ...,
1189         joinstyle: Literal["round", "bevel", "miter"] = ...,
1190         offset: _ScreenUnits = ...,
1191         smooth: bool = ...,
1192         splinesteps: float = ...,
1193         state: Literal["normal", "active", "disabled"] = ...,
1194         stipple: _Bitmap = ...,
1195         tags: str | list[str] | Tuple[str, ...] = ...,
1196         width: _ScreenUnits = ...,
1197     ) -> _CanvasItemId: ...
1198     @overload
1199     def create_line(
1200         self,
1201         __coords: tuple[float, float, float, float] | list[int] | list[float],
1202         *,
1203         activedash: str | list[int] | Tuple[int, ...] = ...,
1204         activefill: _Color = ...,
1205         activestipple: str = ...,
1206         activewidth: _ScreenUnits = ...,
1207         arrow: Literal["first", "last", "both"] = ...,
1208         arrowshape: tuple[float, float, float] = ...,
1209         capstyle: Literal["round", "projecting", "butt"] = ...,
1210         dash: str | list[int] | Tuple[int, ...] = ...,
1211         dashoffset: _ScreenUnits = ...,
1212         disableddash: str | list[int] | Tuple[int, ...] = ...,
1213         disabledfill: _Color = ...,
1214         disabledstipple: _Bitmap = ...,
1215         disabledwidth: _ScreenUnits = ...,
1216         fill: _Color = ...,
1217         joinstyle: Literal["round", "bevel", "miter"] = ...,
1218         offset: _ScreenUnits = ...,
1219         smooth: bool = ...,
1220         splinesteps: float = ...,
1221         state: Literal["normal", "active", "disabled"] = ...,
1222         stipple: _Bitmap = ...,
1223         tags: str | list[str] | Tuple[str, ...] = ...,
1224         width: _ScreenUnits = ...,
1225     ) -> _CanvasItemId: ...
1226     @overload
1227     def create_oval(
1228         self,
1229         __x0: float,
1230         __y0: float,
1231         __x1: float,
1232         __y1: float,
1233         *,
1234         activedash: str | list[int] | Tuple[int, ...] = ...,
1235         activefill: _Color = ...,
1236         activeoutline: _Color = ...,
1237         activeoutlinestipple: _Color = ...,
1238         activestipple: str = ...,
1239         activewidth: _ScreenUnits = ...,
1240         dash: str | list[int] | Tuple[int, ...] = ...,
1241         dashoffset: _ScreenUnits = ...,
1242         disableddash: str | list[int] | Tuple[int, ...] = ...,
1243         disabledfill: _Color = ...,
1244         disabledoutline: _Color = ...,
1245         disabledoutlinestipple: _Color = ...,
1246         disabledstipple: _Bitmap = ...,
1247         disabledwidth: _ScreenUnits = ...,
1248         fill: _Color = ...,
1249         offset: _ScreenUnits = ...,
1250         outline: _Color = ...,
1251         outlineoffset: _ScreenUnits = ...,
1252         outlinestipple: _Bitmap = ...,
1253         state: Literal["normal", "active", "disabled"] = ...,
1254         stipple: _Bitmap = ...,
1255         tags: str | list[str] | Tuple[str, ...] = ...,
1256         width: _ScreenUnits = ...,
1257     ) -> _CanvasItemId: ...
1258     @overload
1259     def create_oval(
1260         self,
1261         __coords: tuple[float, float, float, float] | list[int] | list[float],
1262         *,
1263         activedash: str | list[int] | Tuple[int, ...] = ...,
1264         activefill: _Color = ...,
1265         activeoutline: _Color = ...,
1266         activeoutlinestipple: _Color = ...,
1267         activestipple: str = ...,
1268         activewidth: _ScreenUnits = ...,
1269         dash: str | list[int] | Tuple[int, ...] = ...,
1270         dashoffset: _ScreenUnits = ...,
1271         disableddash: str | list[int] | Tuple[int, ...] = ...,
1272         disabledfill: _Color = ...,
1273         disabledoutline: _Color = ...,
1274         disabledoutlinestipple: _Color = ...,
1275         disabledstipple: _Bitmap = ...,
1276         disabledwidth: _ScreenUnits = ...,
1277         fill: _Color = ...,
1278         offset: _ScreenUnits = ...,
1279         outline: _Color = ...,
1280         outlineoffset: _ScreenUnits = ...,
1281         outlinestipple: _Bitmap = ...,
1282         state: Literal["normal", "active", "disabled"] = ...,
1283         stipple: _Bitmap = ...,
1284         tags: str | list[str] | Tuple[str, ...] = ...,
1285         width: _ScreenUnits = ...,
1286     ) -> _CanvasItemId: ...
1287     @overload
1288     def create_polygon(
1289         self,
1290         __x0: float,
1291         __y0: float,
1292         __x1: float,
1293         __y1: float,
1294         *xy_pairs: float,
1295         activedash: str | list[int] | Tuple[int, ...] = ...,
1296         activefill: _Color = ...,
1297         activeoutline: _Color = ...,
1298         activeoutlinestipple: _Color = ...,
1299         activestipple: str = ...,
1300         activewidth: _ScreenUnits = ...,
1301         dash: str | list[int] | Tuple[int, ...] = ...,
1302         dashoffset: _ScreenUnits = ...,
1303         disableddash: str | list[int] | Tuple[int, ...] = ...,
1304         disabledfill: _Color = ...,
1305         disabledoutline: _Color = ...,
1306         disabledoutlinestipple: _Color = ...,
1307         disabledstipple: _Bitmap = ...,
1308         disabledwidth: _ScreenUnits = ...,
1309         fill: _Color = ...,
1310         joinstyle: Literal["round", "bevel", "miter"] = ...,
1311         offset: _ScreenUnits = ...,
1312         outline: _Color = ...,
1313         outlineoffset: _ScreenUnits = ...,
1314         outlinestipple: _Bitmap = ...,
1315         smooth: bool = ...,
1316         splinesteps: float = ...,
1317         state: Literal["normal", "active", "disabled"] = ...,
1318         stipple: _Bitmap = ...,
1319         tags: str | list[str] | Tuple[str, ...] = ...,
1320         width: _ScreenUnits = ...,
1321     ) -> _CanvasItemId: ...
1322     @overload
1323     def create_polygon(
1324         self,
1325         __coords: Tuple[float, ...] | list[int] | list[float],
1326         *,
1327         activedash: str | list[int] | Tuple[int, ...] = ...,
1328         activefill: _Color = ...,
1329         activeoutline: _Color = ...,
1330         activeoutlinestipple: _Color = ...,
1331         activestipple: str = ...,
1332         activewidth: _ScreenUnits = ...,
1333         dash: str | list[int] | Tuple[int, ...] = ...,
1334         dashoffset: _ScreenUnits = ...,
1335         disableddash: str | list[int] | Tuple[int, ...] = ...,
1336         disabledfill: _Color = ...,
1337         disabledoutline: _Color = ...,
1338         disabledoutlinestipple: _Color = ...,
1339         disabledstipple: _Bitmap = ...,
1340         disabledwidth: _ScreenUnits = ...,
1341         fill: _Color = ...,
1342         joinstyle: Literal["round", "bevel", "miter"] = ...,
1343         offset: _ScreenUnits = ...,
1344         outline: _Color = ...,
1345         outlineoffset: _ScreenUnits = ...,
1346         outlinestipple: _Bitmap = ...,
1347         smooth: bool = ...,
1348         splinesteps: float = ...,
1349         state: Literal["normal", "active", "disabled"] = ...,
1350         stipple: _Bitmap = ...,
1351         tags: str | list[str] | Tuple[str, ...] = ...,
1352         width: _ScreenUnits = ...,
1353     ) -> _CanvasItemId: ...
1354     @overload
1355     def create_rectangle(
1356         self,
1357         __x0: float,
1358         __y0: float,
1359         __x1: float,
1360         __y1: float,
1361         *,
1362         activedash: str | list[int] | Tuple[int, ...] = ...,
1363         activefill: _Color = ...,
1364         activeoutline: _Color = ...,
1365         activeoutlinestipple: _Color = ...,
1366         activestipple: str = ...,
1367         activewidth: _ScreenUnits = ...,
1368         dash: str | list[int] | Tuple[int, ...] = ...,
1369         dashoffset: _ScreenUnits = ...,
1370         disableddash: str | list[int] | Tuple[int, ...] = ...,
1371         disabledfill: _Color = ...,
1372         disabledoutline: _Color = ...,
1373         disabledoutlinestipple: _Color = ...,
1374         disabledstipple: _Bitmap = ...,
1375         disabledwidth: _ScreenUnits = ...,
1376         fill: _Color = ...,
1377         offset: _ScreenUnits = ...,
1378         outline: _Color = ...,
1379         outlineoffset: _ScreenUnits = ...,
1380         outlinestipple: _Bitmap = ...,
1381         state: Literal["normal", "active", "disabled"] = ...,
1382         stipple: _Bitmap = ...,
1383         tags: str | list[str] | Tuple[str, ...] = ...,
1384         width: _ScreenUnits = ...,
1385     ) -> _CanvasItemId: ...
1386     @overload
1387     def create_rectangle(
1388         self,
1389         __coords: tuple[float, float, float, float] | list[int] | list[float],
1390         *,
1391         activedash: str | list[int] | Tuple[int, ...] = ...,
1392         activefill: _Color = ...,
1393         activeoutline: _Color = ...,
1394         activeoutlinestipple: _Color = ...,
1395         activestipple: str = ...,
1396         activewidth: _ScreenUnits = ...,
1397         dash: str | list[int] | Tuple[int, ...] = ...,
1398         dashoffset: _ScreenUnits = ...,
1399         disableddash: str | list[int] | Tuple[int, ...] = ...,
1400         disabledfill: _Color = ...,
1401         disabledoutline: _Color = ...,
1402         disabledoutlinestipple: _Color = ...,
1403         disabledstipple: _Bitmap = ...,
1404         disabledwidth: _ScreenUnits = ...,
1405         fill: _Color = ...,
1406         offset: _ScreenUnits = ...,
1407         outline: _Color = ...,
1408         outlineoffset: _ScreenUnits = ...,
1409         outlinestipple: _Bitmap = ...,
1410         state: Literal["normal", "active", "disabled"] = ...,
1411         stipple: _Bitmap = ...,
1412         tags: str | list[str] | Tuple[str, ...] = ...,
1413         width: _ScreenUnits = ...,
1414     ) -> _CanvasItemId: ...
1415     @overload
1416     def create_text(
1417         self,
1418         __x: float,
1419         __y: float,
1420         *,
1421         activefill: _Color = ...,
1422         activestipple: str = ...,
1423         anchor: _Anchor = ...,
1424         disabledfill: _Color = ...,
1425         disabledstipple: _Bitmap = ...,
1426         fill: _Color = ...,
1427         font: _FontDescription = ...,
1428         justify: Literal["left", "center", "right"] = ...,
1429         offset: _ScreenUnits = ...,
1430         state: Literal["normal", "active", "disabled"] = ...,
1431         stipple: _Bitmap = ...,
1432         tags: str | list[str] | Tuple[str, ...] = ...,
1433         text: float | str = ...,
1434         width: _ScreenUnits = ...,
1435     ) -> _CanvasItemId: ...
1436     @overload
1437     def create_text(
1438         self,
1439         __coords: tuple[float, float] | list[int] | list[float],
1440         *,
1441         activefill: _Color = ...,
1442         activestipple: str = ...,
1443         anchor: _Anchor = ...,
1444         disabledfill: _Color = ...,
1445         disabledstipple: _Bitmap = ...,
1446         fill: _Color = ...,
1447         font: _FontDescription = ...,
1448         justify: Literal["left", "center", "right"] = ...,
1449         offset: _ScreenUnits = ...,
1450         state: Literal["normal", "active", "disabled"] = ...,
1451         stipple: _Bitmap = ...,
1452         tags: str | list[str] | Tuple[str, ...] = ...,
1453         text: float | str = ...,
1454         width: _ScreenUnits = ...,
1455     ) -> _CanvasItemId: ...
1456     @overload
1457     def create_window(
1458         self,
1459         __x: float,
1460         __y: float,
1461         *,
1462         anchor: _Anchor = ...,
1463         height: _ScreenUnits = ...,
1464         state: Literal["normal", "active", "disabled"] = ...,
1465         tags: str | list[str] | Tuple[str, ...] = ...,
1466         width: _ScreenUnits = ...,
1467         window: Widget = ...,
1468     ) -> _CanvasItemId: ...
1469     @overload
1470     def create_window(
1471         self,
1472         __coords: tuple[float, float] | list[int] | list[float],
1473         *,
1474         anchor: _Anchor = ...,
1475         height: _ScreenUnits = ...,
1476         state: Literal["normal", "active", "disabled"] = ...,
1477         tags: str | list[str] | Tuple[str, ...] = ...,
1478         width: _ScreenUnits = ...,
1479         window: Widget = ...,
1480     ) -> _CanvasItemId: ...
1481     def dchars(self, *args): ...
1482     def delete(self, *tagsOrCanvasIds: str | _CanvasItemId) -> None: ...
1483     @overload
1484     def dtag(self, __tag: str, __tag_to_delete: str | None = ...) -> None: ...
1485     @overload
1486     def dtag(self, __id: _CanvasItemId, __tag_to_delete: str) -> None: ...
1487     def focus(self, *args): ...
1488     def gettags(self, __tagOrId: str | _CanvasItemId) -> Tuple[str, ...]: ...
1489     def icursor(self, *args): ...
1490     def index(self, *args): ...
1491     def insert(self, *args): ...
1492     def itemcget(self, tagOrId, option): ...
1493     # itemconfigure kwargs depend on item type, which is not known when type checking
1494     def itemconfigure(
1495         self, tagOrId: str | _CanvasItemId, cnf: dict[str, Any] | None = ..., **kw: Any
1496     ) -> dict[str, tuple[str, str, str, str, str]] | None: ...
1497     itemconfig = itemconfigure
1498     def move(self, *args): ...
1499     if sys.version_info >= (3, 8):
1500         def moveto(self, tagOrId: str | _CanvasItemId, x: Literal[""] | float = ..., y: Literal[""] | float = ...) -> None: ...
1501     def postscript(self, cnf=..., **kw): ...
1502     # tkinter does:
1503     #    lower = tag_lower
1504     #    lift = tkraise = tag_raise
1505     #
1506     # But mypy doesn't like aliasing here (maybe because Misc defines the same names)
1507     def tag_lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ...
1508     def lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ...  # type: ignore
1509     def tag_raise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ...
1510     def tkraise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ...  # type: ignore
1511     def lift(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ...  # type: ignore
1512     def scale(self, *args): ...
1513     def scan_mark(self, x, y): ...
1514     def scan_dragto(self, x, y, gain: int = ...): ...
1515     def select_adjust(self, tagOrId, index): ...
1516     def select_clear(self): ...
1517     def select_from(self, tagOrId, index): ...
1518     def select_item(self): ...
1519     def select_to(self, tagOrId, index): ...
1520     def type(self, tagOrId): ...
1521
1522 class Checkbutton(Widget):
1523     def __init__(
1524         self,
1525         master: Misc | None = ...,
1526         cnf: dict[str, Any] | None = ...,
1527         *,
1528         activebackground: _Color = ...,
1529         activeforeground: _Color = ...,
1530         anchor: _Anchor = ...,
1531         background: _Color = ...,
1532         bd: _ScreenUnits = ...,
1533         bg: _Color = ...,
1534         bitmap: _Bitmap = ...,
1535         border: _ScreenUnits = ...,
1536         borderwidth: _ScreenUnits = ...,
1537         command: _ButtonCommand = ...,
1538         compound: _Compound = ...,
1539         cursor: _Cursor = ...,
1540         disabledforeground: _Color = ...,
1541         fg: _Color = ...,
1542         font: _FontDescription = ...,
1543         foreground: _Color = ...,
1544         height: _ScreenUnits = ...,
1545         highlightbackground: _Color = ...,
1546         highlightcolor: _Color = ...,
1547         highlightthickness: _ScreenUnits = ...,
1548         image: _ImageSpec = ...,
1549         indicatoron: bool = ...,
1550         justify: Literal["left", "center", "right"] = ...,
1551         name: str = ...,
1552         offrelief: _Relief = ...,
1553         # The checkbutton puts a value to its variable when it's checked or
1554         # unchecked. We don't restrict the type of that value here, so
1555         # Any-typing is fine.
1556         #
1557         # I think Checkbutton shouldn't be generic, because then specifying
1558         # "any checkbutton regardless of what variable it uses" would be
1559         # difficult, and we might run into issues just like how list[float]
1560         # and list[int] are incompatible. Also, we would need a way to
1561         # specify "Checkbutton not associated with any variable", which is
1562         # done by setting variable to empty string (the default).
1563         offvalue: Any = ...,
1564         onvalue: Any = ...,
1565         overrelief: _Relief = ...,
1566         padx: _ScreenUnits = ...,
1567         pady: _ScreenUnits = ...,
1568         relief: _Relief = ...,
1569         selectcolor: _Color = ...,
1570         selectimage: _ImageSpec = ...,
1571         state: Literal["normal", "active", "disabled"] = ...,
1572         takefocus: _TakeFocusValue = ...,
1573         text: float | str = ...,
1574         textvariable: Variable = ...,
1575         tristateimage: _ImageSpec = ...,
1576         tristatevalue: Any = ...,
1577         underline: int = ...,
1578         variable: Variable | Literal[""] = ...,
1579         width: _ScreenUnits = ...,
1580         wraplength: _ScreenUnits = ...,
1581     ) -> None: ...
1582     @overload
1583     def configure(
1584         self,
1585         cnf: dict[str, Any] | None = ...,
1586         *,
1587         activebackground: _Color = ...,
1588         activeforeground: _Color = ...,
1589         anchor: _Anchor = ...,
1590         background: _Color = ...,
1591         bd: _ScreenUnits = ...,
1592         bg: _Color = ...,
1593         bitmap: _Bitmap = ...,
1594         border: _ScreenUnits = ...,
1595         borderwidth: _ScreenUnits = ...,
1596         command: _ButtonCommand = ...,
1597         compound: _Compound = ...,
1598         cursor: _Cursor = ...,
1599         disabledforeground: _Color = ...,
1600         fg: _Color = ...,
1601         font: _FontDescription = ...,
1602         foreground: _Color = ...,
1603         height: _ScreenUnits = ...,
1604         highlightbackground: _Color = ...,
1605         highlightcolor: _Color = ...,
1606         highlightthickness: _ScreenUnits = ...,
1607         image: _ImageSpec = ...,
1608         indicatoron: bool = ...,
1609         justify: Literal["left", "center", "right"] = ...,
1610         offrelief: _Relief = ...,
1611         offvalue: Any = ...,
1612         onvalue: Any = ...,
1613         overrelief: _Relief = ...,
1614         padx: _ScreenUnits = ...,
1615         pady: _ScreenUnits = ...,
1616         relief: _Relief = ...,
1617         selectcolor: _Color = ...,
1618         selectimage: _ImageSpec = ...,
1619         state: Literal["normal", "active", "disabled"] = ...,
1620         takefocus: _TakeFocusValue = ...,
1621         text: float | str = ...,
1622         textvariable: Variable = ...,
1623         tristateimage: _ImageSpec = ...,
1624         tristatevalue: Any = ...,
1625         underline: int = ...,
1626         variable: Variable | Literal[""] = ...,
1627         width: _ScreenUnits = ...,
1628         wraplength: _ScreenUnits = ...,
1629     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
1630     @overload
1631     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
1632     config = configure
1633     def deselect(self): ...
1634     def flash(self): ...
1635     def invoke(self) -> Any: ...
1636     def select(self): ...
1637     def toggle(self): ...
1638
1639 _EntryIndex = Union[str, int]  # "INDICES" in manual page
1640
1641 class Entry(Widget, XView):
1642     def __init__(
1643         self,
1644         master: Misc | None = ...,
1645         cnf: dict[str, Any] | None = ...,
1646         *,
1647         background: _Color = ...,
1648         bd: _ScreenUnits = ...,
1649         bg: _Color = ...,
1650         border: _ScreenUnits = ...,
1651         borderwidth: _ScreenUnits = ...,
1652         cursor: _Cursor = ...,
1653         disabledbackground: _Color = ...,
1654         disabledforeground: _Color = ...,
1655         exportselection: bool = ...,
1656         fg: _Color = ...,
1657         font: _FontDescription = ...,
1658         foreground: _Color = ...,
1659         highlightbackground: _Color = ...,
1660         highlightcolor: _Color = ...,
1661         highlightthickness: _ScreenUnits = ...,
1662         insertbackground: _Color = ...,
1663         insertborderwidth: _ScreenUnits = ...,
1664         insertofftime: int = ...,
1665         insertontime: int = ...,
1666         insertwidth: _ScreenUnits = ...,
1667         invalidcommand: _EntryValidateCommand = ...,
1668         invcmd: _EntryValidateCommand = ...,  # same as invalidcommand
1669         justify: Literal["left", "center", "right"] = ...,
1670         name: str = ...,
1671         readonlybackground: _Color = ...,
1672         relief: _Relief = ...,
1673         selectbackground: _Color = ...,
1674         selectborderwidth: _ScreenUnits = ...,
1675         selectforeground: _Color = ...,
1676         show: str = ...,
1677         state: Literal["normal", "disabled", "readonly"] = ...,
1678         takefocus: _TakeFocusValue = ...,
1679         textvariable: Variable = ...,
1680         validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
1681         validatecommand: _EntryValidateCommand = ...,
1682         vcmd: _EntryValidateCommand = ...,  # same as validatecommand
1683         width: int = ...,
1684         xscrollcommand: _XYScrollCommand = ...,
1685     ) -> None: ...
1686     @overload
1687     def configure(
1688         self,
1689         cnf: dict[str, Any] | None = ...,
1690         *,
1691         background: _Color = ...,
1692         bd: _ScreenUnits = ...,
1693         bg: _Color = ...,
1694         border: _ScreenUnits = ...,
1695         borderwidth: _ScreenUnits = ...,
1696         cursor: _Cursor = ...,
1697         disabledbackground: _Color = ...,
1698         disabledforeground: _Color = ...,
1699         exportselection: bool = ...,
1700         fg: _Color = ...,
1701         font: _FontDescription = ...,
1702         foreground: _Color = ...,
1703         highlightbackground: _Color = ...,
1704         highlightcolor: _Color = ...,
1705         highlightthickness: _ScreenUnits = ...,
1706         insertbackground: _Color = ...,
1707         insertborderwidth: _ScreenUnits = ...,
1708         insertofftime: int = ...,
1709         insertontime: int = ...,
1710         insertwidth: _ScreenUnits = ...,
1711         invalidcommand: _EntryValidateCommand = ...,
1712         invcmd: _EntryValidateCommand = ...,
1713         justify: Literal["left", "center", "right"] = ...,
1714         readonlybackground: _Color = ...,
1715         relief: _Relief = ...,
1716         selectbackground: _Color = ...,
1717         selectborderwidth: _ScreenUnits = ...,
1718         selectforeground: _Color = ...,
1719         show: str = ...,
1720         state: Literal["normal", "disabled", "readonly"] = ...,
1721         takefocus: _TakeFocusValue = ...,
1722         textvariable: Variable = ...,
1723         validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
1724         validatecommand: _EntryValidateCommand = ...,
1725         vcmd: _EntryValidateCommand = ...,
1726         width: int = ...,
1727         xscrollcommand: _XYScrollCommand = ...,
1728     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
1729     @overload
1730     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
1731     config = configure
1732     def delete(self, first: _EntryIndex, last: _EntryIndex | None = ...) -> None: ...
1733     def get(self) -> str: ...
1734     def icursor(self, index: _EntryIndex) -> None: ...
1735     def index(self, index: _EntryIndex) -> int: ...
1736     def insert(self, index: _EntryIndex, string: str) -> None: ...
1737     def scan_mark(self, x): ...
1738     def scan_dragto(self, x): ...
1739     def selection_adjust(self, index: _EntryIndex) -> None: ...
1740     def selection_clear(self) -> None: ...  # type: ignore
1741     def selection_from(self, index: _EntryIndex) -> None: ...
1742     def selection_present(self) -> bool: ...
1743     def selection_range(self, start: _EntryIndex, end: _EntryIndex) -> None: ...
1744     def selection_to(self, index: _EntryIndex) -> None: ...
1745     select_adjust = selection_adjust
1746     select_clear = selection_clear
1747     select_from = selection_from
1748     select_present = selection_present
1749     select_range = selection_range
1750     select_to = selection_to
1751
1752 class Frame(Widget):
1753     def __init__(
1754         self,
1755         master: Misc | None = ...,
1756         cnf: dict[str, Any] | None = ...,
1757         *,
1758         background: _Color = ...,
1759         bd: _ScreenUnits = ...,
1760         bg: _Color = ...,
1761         border: _ScreenUnits = ...,
1762         borderwidth: _ScreenUnits = ...,
1763         class_: str = ...,
1764         colormap: Literal["new", ""] | Misc = ...,
1765         container: bool = ...,
1766         cursor: _Cursor = ...,
1767         height: _ScreenUnits = ...,
1768         highlightbackground: _Color = ...,
1769         highlightcolor: _Color = ...,
1770         highlightthickness: _ScreenUnits = ...,
1771         name: str = ...,
1772         padx: _ScreenUnits = ...,
1773         pady: _ScreenUnits = ...,
1774         relief: _Relief = ...,
1775         takefocus: _TakeFocusValue = ...,
1776         visual: str | tuple[str, int] = ...,
1777         width: _ScreenUnits = ...,
1778     ) -> None: ...
1779     @overload
1780     def configure(
1781         self,
1782         cnf: dict[str, Any] | None = ...,
1783         *,
1784         background: _Color = ...,
1785         bd: _ScreenUnits = ...,
1786         bg: _Color = ...,
1787         border: _ScreenUnits = ...,
1788         borderwidth: _ScreenUnits = ...,
1789         cursor: _Cursor = ...,
1790         height: _ScreenUnits = ...,
1791         highlightbackground: _Color = ...,
1792         highlightcolor: _Color = ...,
1793         highlightthickness: _ScreenUnits = ...,
1794         padx: _ScreenUnits = ...,
1795         pady: _ScreenUnits = ...,
1796         relief: _Relief = ...,
1797         takefocus: _TakeFocusValue = ...,
1798         width: _ScreenUnits = ...,
1799     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
1800     @overload
1801     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
1802     config = configure
1803
1804 class Label(Widget):
1805     def __init__(
1806         self,
1807         master: Misc | None = ...,
1808         cnf: dict[str, Any] | None = ...,
1809         *,
1810         activebackground: _Color = ...,
1811         activeforeground: _Color = ...,
1812         anchor: _Anchor = ...,
1813         background: _Color = ...,
1814         bd: _ScreenUnits = ...,
1815         bg: _Color = ...,
1816         bitmap: _Bitmap = ...,
1817         border: _ScreenUnits = ...,
1818         borderwidth: _ScreenUnits = ...,
1819         compound: _Compound = ...,
1820         cursor: _Cursor = ...,
1821         disabledforeground: _Color = ...,
1822         fg: _Color = ...,
1823         font: _FontDescription = ...,
1824         foreground: _Color = ...,
1825         height: _ScreenUnits = ...,
1826         highlightbackground: _Color = ...,
1827         highlightcolor: _Color = ...,
1828         highlightthickness: _ScreenUnits = ...,
1829         image: _ImageSpec = ...,
1830         justify: Literal["left", "center", "right"] = ...,
1831         name: str = ...,
1832         padx: _ScreenUnits = ...,
1833         pady: _ScreenUnits = ...,
1834         relief: _Relief = ...,
1835         state: Literal["normal", "active", "disabled"] = ...,
1836         takefocus: _TakeFocusValue = ...,
1837         text: float | str = ...,
1838         textvariable: Variable = ...,
1839         underline: int = ...,
1840         width: _ScreenUnits = ...,
1841         wraplength: _ScreenUnits = ...,
1842     ) -> None: ...
1843     @overload
1844     def configure(
1845         self,
1846         cnf: dict[str, Any] | None = ...,
1847         *,
1848         activebackground: _Color = ...,
1849         activeforeground: _Color = ...,
1850         anchor: _Anchor = ...,
1851         background: _Color = ...,
1852         bd: _ScreenUnits = ...,
1853         bg: _Color = ...,
1854         bitmap: _Bitmap = ...,
1855         border: _ScreenUnits = ...,
1856         borderwidth: _ScreenUnits = ...,
1857         compound: _Compound = ...,
1858         cursor: _Cursor = ...,
1859         disabledforeground: _Color = ...,
1860         fg: _Color = ...,
1861         font: _FontDescription = ...,
1862         foreground: _Color = ...,
1863         height: _ScreenUnits = ...,
1864         highlightbackground: _Color = ...,
1865         highlightcolor: _Color = ...,
1866         highlightthickness: _ScreenUnits = ...,
1867         image: _ImageSpec = ...,
1868         justify: Literal["left", "center", "right"] = ...,
1869         padx: _ScreenUnits = ...,
1870         pady: _ScreenUnits = ...,
1871         relief: _Relief = ...,
1872         state: Literal["normal", "active", "disabled"] = ...,
1873         takefocus: _TakeFocusValue = ...,
1874         text: float | str = ...,
1875         textvariable: Variable = ...,
1876         underline: int = ...,
1877         width: _ScreenUnits = ...,
1878         wraplength: _ScreenUnits = ...,
1879     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
1880     @overload
1881     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
1882     config = configure
1883
1884 class Listbox(Widget, XView, YView):
1885     def __init__(
1886         self,
1887         master: Misc | None = ...,
1888         cnf: dict[str, Any] | None = ...,
1889         *,
1890         activestyle: Literal["dotbox", "none", "underline"] = ...,
1891         background: _Color = ...,
1892         bd: _ScreenUnits = ...,
1893         bg: _Color = ...,
1894         border: _ScreenUnits = ...,
1895         borderwidth: _ScreenUnits = ...,
1896         cursor: _Cursor = ...,
1897         disabledforeground: _Color = ...,
1898         exportselection: int = ...,
1899         fg: _Color = ...,
1900         font: _FontDescription = ...,
1901         foreground: _Color = ...,
1902         height: int = ...,
1903         highlightbackground: _Color = ...,
1904         highlightcolor: _Color = ...,
1905         highlightthickness: _ScreenUnits = ...,
1906         justify: Literal["left", "center", "right"] = ...,
1907         # There's no tkinter.ListVar, but seems like bare tkinter.Variable
1908         # actually works for this:
1909         #
1910         #    >>> import tkinter
1911         #    >>> lb = tkinter.Listbox()
1912         #    >>> var = lb['listvariable'] = tkinter.Variable()
1913         #    >>> var.set(['foo', 'bar', 'baz'])
1914         #    >>> lb.get(0, 'end')
1915         #    ('foo', 'bar', 'baz')
1916         listvariable: Variable = ...,
1917         name: str = ...,
1918         relief: _Relief = ...,
1919         selectbackground: _Color = ...,
1920         selectborderwidth: _ScreenUnits = ...,
1921         selectforeground: _Color = ...,
1922         # from listbox man page: "The value of the [selectmode] option may be
1923         # arbitrary, but the default bindings expect it to be ..."
1924         #
1925         # I have never seen anyone setting this to something else than what
1926         # "the default bindings expect", but let's support it anyway.
1927         selectmode: str = ...,
1928         setgrid: bool = ...,
1929         state: Literal["normal", "disabled"] = ...,
1930         takefocus: _TakeFocusValue = ...,
1931         width: int = ...,
1932         xscrollcommand: _XYScrollCommand = ...,
1933         yscrollcommand: _XYScrollCommand = ...,
1934     ) -> None: ...
1935     @overload
1936     def configure(
1937         self,
1938         cnf: dict[str, Any] | None = ...,
1939         *,
1940         activestyle: Literal["dotbox", "none", "underline"] = ...,
1941         background: _Color = ...,
1942         bd: _ScreenUnits = ...,
1943         bg: _Color = ...,
1944         border: _ScreenUnits = ...,
1945         borderwidth: _ScreenUnits = ...,
1946         cursor: _Cursor = ...,
1947         disabledforeground: _Color = ...,
1948         exportselection: bool = ...,
1949         fg: _Color = ...,
1950         font: _FontDescription = ...,
1951         foreground: _Color = ...,
1952         height: int = ...,
1953         highlightbackground: _Color = ...,
1954         highlightcolor: _Color = ...,
1955         highlightthickness: _ScreenUnits = ...,
1956         justify: Literal["left", "center", "right"] = ...,
1957         listvariable: Variable = ...,
1958         relief: _Relief = ...,
1959         selectbackground: _Color = ...,
1960         selectborderwidth: _ScreenUnits = ...,
1961         selectforeground: _Color = ...,
1962         selectmode: str = ...,
1963         setgrid: bool = ...,
1964         state: Literal["normal", "disabled"] = ...,
1965         takefocus: _TakeFocusValue = ...,
1966         width: int = ...,
1967         xscrollcommand: _XYScrollCommand = ...,
1968         yscrollcommand: _XYScrollCommand = ...,
1969     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
1970     @overload
1971     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
1972     config = configure
1973     def activate(self, index): ...
1974     def bbox(self, index): ...
1975     def curselection(self): ...
1976     def delete(self, first, last: Any | None = ...): ...
1977     def get(self, first, last: Any | None = ...): ...
1978     def index(self, index): ...
1979     def insert(self, index, *elements): ...
1980     def nearest(self, y): ...
1981     def scan_mark(self, x, y): ...
1982     def scan_dragto(self, x, y): ...
1983     def see(self, index): ...
1984     def selection_anchor(self, index): ...
1985     select_anchor: Any
1986     def selection_clear(self, first, last: Any | None = ...): ...  # type: ignore
1987     select_clear: Any
1988     def selection_includes(self, index): ...
1989     select_includes: Any
1990     def selection_set(self, first, last: Any | None = ...): ...
1991     select_set: Any
1992     def size(self): ...
1993     def itemcget(self, index, option): ...
1994     def itemconfigure(self, index, cnf: Any | None = ..., **kw): ...
1995     itemconfig: Any
1996
1997 _MenuIndex = Union[str, int]
1998
1999 class Menu(Widget):
2000     def __init__(
2001         self,
2002         master: Misc | None = ...,
2003         cnf: dict[str, Any] | None = ...,
2004         *,
2005         activebackground: _Color = ...,
2006         activeborderwidth: _ScreenUnits = ...,
2007         activeforeground: _Color = ...,
2008         background: _Color = ...,
2009         bd: _ScreenUnits = ...,
2010         bg: _Color = ...,
2011         border: _ScreenUnits = ...,
2012         borderwidth: _ScreenUnits = ...,
2013         cursor: _Cursor = ...,
2014         disabledforeground: _Color = ...,
2015         fg: _Color = ...,
2016         font: _FontDescription = ...,
2017         foreground: _Color = ...,
2018         name: str = ...,
2019         postcommand: Callable[[], Any] | str = ...,
2020         relief: _Relief = ...,
2021         selectcolor: _Color = ...,
2022         takefocus: _TakeFocusValue = ...,
2023         tearoff: int = ...,
2024         # I guess tearoffcommand arguments are supposed to be widget objects,
2025         # but they are widget name strings. Use nametowidget() to handle the
2026         # arguments of tearoffcommand.
2027         tearoffcommand: Callable[[str, str], Any] | str = ...,
2028         title: str = ...,
2029         type: Literal["menubar", "tearoff", "normal"] = ...,
2030     ) -> None: ...
2031     @overload
2032     def configure(
2033         self,
2034         cnf: dict[str, Any] | None = ...,
2035         *,
2036         activebackground: _Color = ...,
2037         activeborderwidth: _ScreenUnits = ...,
2038         activeforeground: _Color = ...,
2039         background: _Color = ...,
2040         bd: _ScreenUnits = ...,
2041         bg: _Color = ...,
2042         border: _ScreenUnits = ...,
2043         borderwidth: _ScreenUnits = ...,
2044         cursor: _Cursor = ...,
2045         disabledforeground: _Color = ...,
2046         fg: _Color = ...,
2047         font: _FontDescription = ...,
2048         foreground: _Color = ...,
2049         postcommand: Callable[[], Any] | str = ...,
2050         relief: _Relief = ...,
2051         selectcolor: _Color = ...,
2052         takefocus: _TakeFocusValue = ...,
2053         tearoff: bool = ...,
2054         tearoffcommand: Callable[[str, str], Any] | str = ...,
2055         title: str = ...,
2056         type: Literal["menubar", "tearoff", "normal"] = ...,
2057     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2058     @overload
2059     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2060     config = configure
2061     def tk_popup(self, x: int, y: int, entry: _MenuIndex = ...) -> None: ...
2062     def activate(self, index: _MenuIndex) -> None: ...
2063     def add(self, itemType, cnf=..., **kw): ...  # docstring says "Internal function."
2064     def insert(self, index, itemType, cnf=..., **kw): ...  # docstring says "Internal function."
2065     def add_cascade(
2066         self,
2067         cnf: dict[str, Any] | None = ...,
2068         *,
2069         accelerator: str = ...,
2070         activebackground: _Color = ...,
2071         activeforeground: _Color = ...,
2072         background: _Color = ...,
2073         bitmap: _Bitmap = ...,
2074         columnbreak: int = ...,
2075         command: Callable[[], Any] | str = ...,
2076         compound: _Compound = ...,
2077         font: _FontDescription = ...,
2078         foreground: _Color = ...,
2079         hidemargin: bool = ...,
2080         image: _ImageSpec = ...,
2081         label: str = ...,
2082         menu: Menu = ...,
2083         state: Literal["normal", "active", "disabled"] = ...,
2084         underline: int = ...,
2085     ) -> None: ...
2086     def add_checkbutton(
2087         self,
2088         cnf: dict[str, Any] | None = ...,
2089         *,
2090         accelerator: str = ...,
2091         activebackground: _Color = ...,
2092         activeforeground: _Color = ...,
2093         background: _Color = ...,
2094         bitmap: _Bitmap = ...,
2095         columnbreak: int = ...,
2096         command: Callable[[], Any] | str = ...,
2097         compound: _Compound = ...,
2098         font: _FontDescription = ...,
2099         foreground: _Color = ...,
2100         hidemargin: bool = ...,
2101         image: _ImageSpec = ...,
2102         indicatoron: bool = ...,
2103         label: str = ...,
2104         offvalue: Any = ...,
2105         onvalue: Any = ...,
2106         selectcolor: _Color = ...,
2107         selectimage: _ImageSpec = ...,
2108         state: Literal["normal", "active", "disabled"] = ...,
2109         underline: int = ...,
2110         variable: Variable = ...,
2111     ) -> None: ...
2112     def add_command(
2113         self,
2114         cnf: dict[str, Any] | None = ...,
2115         *,
2116         accelerator: str = ...,
2117         activebackground: _Color = ...,
2118         activeforeground: _Color = ...,
2119         background: _Color = ...,
2120         bitmap: _Bitmap = ...,
2121         columnbreak: int = ...,
2122         command: Callable[[], Any] | str = ...,
2123         compound: _Compound = ...,
2124         font: _FontDescription = ...,
2125         foreground: _Color = ...,
2126         hidemargin: bool = ...,
2127         image: _ImageSpec = ...,
2128         label: str = ...,
2129         state: Literal["normal", "active", "disabled"] = ...,
2130         underline: int = ...,
2131     ) -> None: ...
2132     def add_radiobutton(
2133         self,
2134         cnf: dict[str, Any] | None = ...,
2135         *,
2136         accelerator: str = ...,
2137         activebackground: _Color = ...,
2138         activeforeground: _Color = ...,
2139         background: _Color = ...,
2140         bitmap: _Bitmap = ...,
2141         columnbreak: int = ...,
2142         command: Callable[[], Any] | str = ...,
2143         compound: _Compound = ...,
2144         font: _FontDescription = ...,
2145         foreground: _Color = ...,
2146         hidemargin: bool = ...,
2147         image: _ImageSpec = ...,
2148         indicatoron: bool = ...,
2149         label: str = ...,
2150         selectcolor: _Color = ...,
2151         selectimage: _ImageSpec = ...,
2152         state: Literal["normal", "active", "disabled"] = ...,
2153         underline: int = ...,
2154         value: Any = ...,
2155         variable: Variable = ...,
2156     ) -> None: ...
2157     def add_separator(self, cnf: dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ...
2158     def insert_cascade(
2159         self,
2160         index: _MenuIndex,
2161         cnf: dict[str, Any] | None = ...,
2162         *,
2163         accelerator: str = ...,
2164         activebackground: _Color = ...,
2165         activeforeground: _Color = ...,
2166         background: _Color = ...,
2167         bitmap: _Bitmap = ...,
2168         columnbreak: int = ...,
2169         command: Callable[[], Any] | str = ...,
2170         compound: _Compound = ...,
2171         font: _FontDescription = ...,
2172         foreground: _Color = ...,
2173         hidemargin: bool = ...,
2174         image: _ImageSpec = ...,
2175         label: str = ...,
2176         menu: Menu = ...,
2177         state: Literal["normal", "active", "disabled"] = ...,
2178         underline: int = ...,
2179     ) -> None: ...
2180     def insert_checkbutton(
2181         self,
2182         index: _MenuIndex,
2183         cnf: dict[str, Any] | None = ...,
2184         *,
2185         accelerator: str = ...,
2186         activebackground: _Color = ...,
2187         activeforeground: _Color = ...,
2188         background: _Color = ...,
2189         bitmap: _Bitmap = ...,
2190         columnbreak: int = ...,
2191         command: Callable[[], Any] | str = ...,
2192         compound: _Compound = ...,
2193         font: _FontDescription = ...,
2194         foreground: _Color = ...,
2195         hidemargin: bool = ...,
2196         image: _ImageSpec = ...,
2197         indicatoron: bool = ...,
2198         label: str = ...,
2199         offvalue: Any = ...,
2200         onvalue: Any = ...,
2201         selectcolor: _Color = ...,
2202         selectimage: _ImageSpec = ...,
2203         state: Literal["normal", "active", "disabled"] = ...,
2204         underline: int = ...,
2205         variable: Variable = ...,
2206     ) -> None: ...
2207     def insert_command(
2208         self,
2209         index: _MenuIndex,
2210         cnf: dict[str, Any] | None = ...,
2211         *,
2212         accelerator: str = ...,
2213         activebackground: _Color = ...,
2214         activeforeground: _Color = ...,
2215         background: _Color = ...,
2216         bitmap: _Bitmap = ...,
2217         columnbreak: int = ...,
2218         command: Callable[[], Any] | str = ...,
2219         compound: _Compound = ...,
2220         font: _FontDescription = ...,
2221         foreground: _Color = ...,
2222         hidemargin: bool = ...,
2223         image: _ImageSpec = ...,
2224         label: str = ...,
2225         state: Literal["normal", "active", "disabled"] = ...,
2226         underline: int = ...,
2227     ) -> None: ...
2228     def insert_radiobutton(
2229         self,
2230         index: _MenuIndex,
2231         cnf: dict[str, Any] | None = ...,
2232         *,
2233         accelerator: str = ...,
2234         activebackground: _Color = ...,
2235         activeforeground: _Color = ...,
2236         background: _Color = ...,
2237         bitmap: _Bitmap = ...,
2238         columnbreak: int = ...,
2239         command: Callable[[], Any] | str = ...,
2240         compound: _Compound = ...,
2241         font: _FontDescription = ...,
2242         foreground: _Color = ...,
2243         hidemargin: bool = ...,
2244         image: _ImageSpec = ...,
2245         indicatoron: bool = ...,
2246         label: str = ...,
2247         selectcolor: _Color = ...,
2248         selectimage: _ImageSpec = ...,
2249         state: Literal["normal", "active", "disabled"] = ...,
2250         underline: int = ...,
2251         value: Any = ...,
2252         variable: Variable = ...,
2253     ) -> None: ...
2254     def insert_separator(self, index: _MenuIndex, cnf: dict[str, Any] | None = ..., *, background: _Color = ...) -> None: ...
2255     def delete(self, index1: _MenuIndex, index2: _MenuIndex | None = ...) -> None: ...
2256     def entrycget(self, index: _MenuIndex, option: str) -> Any: ...
2257     def entryconfigure(
2258         self, index: _MenuIndex, cnf: dict[str, Any] | None = ..., **kw: Any
2259     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2260     entryconfig = entryconfigure
2261     def index(self, index: _MenuIndex) -> int | None: ...
2262     def invoke(self, index: _MenuIndex) -> Any: ...
2263     def post(self, x: int, y: int) -> None: ...
2264     def type(self, index: _MenuIndex) -> Literal["cascade", "checkbutton", "command", "radiobutton", "separator"]: ...
2265     def unpost(self) -> None: ...
2266     def xposition(self, index: _MenuIndex) -> int: ...
2267     def yposition(self, index: _MenuIndex) -> int: ...
2268
2269 class Menubutton(Widget):
2270     def __init__(
2271         self,
2272         master: Misc | None = ...,
2273         cnf: dict[str, Any] | None = ...,
2274         *,
2275         activebackground: _Color = ...,
2276         activeforeground: _Color = ...,
2277         anchor: _Anchor = ...,
2278         background: _Color = ...,
2279         bd: _ScreenUnits = ...,
2280         bg: _Color = ...,
2281         bitmap: _Bitmap = ...,
2282         border: _ScreenUnits = ...,
2283         borderwidth: _ScreenUnits = ...,
2284         compound: _Compound = ...,
2285         cursor: _Cursor = ...,
2286         direction: Literal["above", "below", "left", "right", "flush"] = ...,
2287         disabledforeground: _Color = ...,
2288         fg: _Color = ...,
2289         font: _FontDescription = ...,
2290         foreground: _Color = ...,
2291         height: _ScreenUnits = ...,
2292         highlightbackground: _Color = ...,
2293         highlightcolor: _Color = ...,
2294         highlightthickness: _ScreenUnits = ...,
2295         image: _ImageSpec = ...,
2296         indicatoron: bool = ...,
2297         justify: Literal["left", "center", "right"] = ...,
2298         menu: Menu = ...,
2299         name: str = ...,
2300         padx: _ScreenUnits = ...,
2301         pady: _ScreenUnits = ...,
2302         relief: _Relief = ...,
2303         state: Literal["normal", "active", "disabled"] = ...,
2304         takefocus: _TakeFocusValue = ...,
2305         text: float | str = ...,
2306         textvariable: Variable = ...,
2307         underline: int = ...,
2308         width: _ScreenUnits = ...,
2309         wraplength: _ScreenUnits = ...,
2310     ) -> None: ...
2311     @overload
2312     def configure(
2313         self,
2314         cnf: dict[str, Any] | None = ...,
2315         *,
2316         activebackground: _Color = ...,
2317         activeforeground: _Color = ...,
2318         anchor: _Anchor = ...,
2319         background: _Color = ...,
2320         bd: _ScreenUnits = ...,
2321         bg: _Color = ...,
2322         bitmap: _Bitmap = ...,
2323         border: _ScreenUnits = ...,
2324         borderwidth: _ScreenUnits = ...,
2325         compound: _Compound = ...,
2326         cursor: _Cursor = ...,
2327         direction: Literal["above", "below", "left", "right", "flush"] = ...,
2328         disabledforeground: _Color = ...,
2329         fg: _Color = ...,
2330         font: _FontDescription = ...,
2331         foreground: _Color = ...,
2332         height: _ScreenUnits = ...,
2333         highlightbackground: _Color = ...,
2334         highlightcolor: _Color = ...,
2335         highlightthickness: _ScreenUnits = ...,
2336         image: _ImageSpec = ...,
2337         indicatoron: bool = ...,
2338         justify: Literal["left", "center", "right"] = ...,
2339         menu: Menu = ...,
2340         padx: _ScreenUnits = ...,
2341         pady: _ScreenUnits = ...,
2342         relief: _Relief = ...,
2343         state: Literal["normal", "active", "disabled"] = ...,
2344         takefocus: _TakeFocusValue = ...,
2345         text: float | str = ...,
2346         textvariable: Variable = ...,
2347         underline: int = ...,
2348         width: _ScreenUnits = ...,
2349         wraplength: _ScreenUnits = ...,
2350     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2351     @overload
2352     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2353     config = configure
2354
2355 class Message(Widget):
2356     def __init__(
2357         self,
2358         master: Misc | None = ...,
2359         cnf: dict[str, Any] | None = ...,
2360         *,
2361         anchor: _Anchor = ...,
2362         aspect: int = ...,
2363         background: _Color = ...,
2364         bd: _ScreenUnits = ...,
2365         bg: _Color = ...,
2366         border: _ScreenUnits = ...,
2367         borderwidth: _ScreenUnits = ...,
2368         cursor: _Cursor = ...,
2369         fg: _Color = ...,
2370         font: _FontDescription = ...,
2371         foreground: _Color = ...,
2372         highlightbackground: _Color = ...,
2373         highlightcolor: _Color = ...,
2374         highlightthickness: _ScreenUnits = ...,
2375         justify: Literal["left", "center", "right"] = ...,
2376         name: str = ...,
2377         padx: _ScreenUnits = ...,
2378         pady: _ScreenUnits = ...,
2379         relief: _Relief = ...,
2380         takefocus: _TakeFocusValue = ...,
2381         text: float | str = ...,
2382         textvariable: Variable = ...,
2383         # there's width but no height
2384         width: _ScreenUnits = ...,
2385     ) -> None: ...
2386     @overload
2387     def configure(
2388         self,
2389         cnf: dict[str, Any] | None = ...,
2390         *,
2391         anchor: _Anchor = ...,
2392         aspect: int = ...,
2393         background: _Color = ...,
2394         bd: _ScreenUnits = ...,
2395         bg: _Color = ...,
2396         border: _ScreenUnits = ...,
2397         borderwidth: _ScreenUnits = ...,
2398         cursor: _Cursor = ...,
2399         fg: _Color = ...,
2400         font: _FontDescription = ...,
2401         foreground: _Color = ...,
2402         highlightbackground: _Color = ...,
2403         highlightcolor: _Color = ...,
2404         highlightthickness: _ScreenUnits = ...,
2405         justify: Literal["left", "center", "right"] = ...,
2406         padx: _ScreenUnits = ...,
2407         pady: _ScreenUnits = ...,
2408         relief: _Relief = ...,
2409         takefocus: _TakeFocusValue = ...,
2410         text: float | str = ...,
2411         textvariable: Variable = ...,
2412         width: _ScreenUnits = ...,
2413     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2414     @overload
2415     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2416     config = configure
2417
2418 class Radiobutton(Widget):
2419     def __init__(
2420         self,
2421         master: Misc | None = ...,
2422         cnf: dict[str, Any] | None = ...,
2423         *,
2424         activebackground: _Color = ...,
2425         activeforeground: _Color = ...,
2426         anchor: _Anchor = ...,
2427         background: _Color = ...,
2428         bd: _ScreenUnits = ...,
2429         bg: _Color = ...,
2430         bitmap: _Bitmap = ...,
2431         border: _ScreenUnits = ...,
2432         borderwidth: _ScreenUnits = ...,
2433         command: _ButtonCommand = ...,
2434         compound: _Compound = ...,
2435         cursor: _Cursor = ...,
2436         disabledforeground: _Color = ...,
2437         fg: _Color = ...,
2438         font: _FontDescription = ...,
2439         foreground: _Color = ...,
2440         height: _ScreenUnits = ...,
2441         highlightbackground: _Color = ...,
2442         highlightcolor: _Color = ...,
2443         highlightthickness: _ScreenUnits = ...,
2444         image: _ImageSpec = ...,
2445         indicatoron: bool = ...,
2446         justify: Literal["left", "center", "right"] = ...,
2447         name: str = ...,
2448         offrelief: _Relief = ...,
2449         overrelief: _Relief = ...,
2450         padx: _ScreenUnits = ...,
2451         pady: _ScreenUnits = ...,
2452         relief: _Relief = ...,
2453         selectcolor: _Color = ...,
2454         selectimage: _ImageSpec = ...,
2455         state: Literal["normal", "active", "disabled"] = ...,
2456         takefocus: _TakeFocusValue = ...,
2457         text: float | str = ...,
2458         textvariable: Variable = ...,
2459         tristateimage: _ImageSpec = ...,
2460         tristatevalue: Any = ...,
2461         underline: int = ...,
2462         value: Any = ...,
2463         variable: Variable | Literal[""] = ...,
2464         width: _ScreenUnits = ...,
2465         wraplength: _ScreenUnits = ...,
2466     ) -> None: ...
2467     @overload
2468     def configure(
2469         self,
2470         cnf: dict[str, Any] | None = ...,
2471         *,
2472         activebackground: _Color = ...,
2473         activeforeground: _Color = ...,
2474         anchor: _Anchor = ...,
2475         background: _Color = ...,
2476         bd: _ScreenUnits = ...,
2477         bg: _Color = ...,
2478         bitmap: _Bitmap = ...,
2479         border: _ScreenUnits = ...,
2480         borderwidth: _ScreenUnits = ...,
2481         command: _ButtonCommand = ...,
2482         compound: _Compound = ...,
2483         cursor: _Cursor = ...,
2484         disabledforeground: _Color = ...,
2485         fg: _Color = ...,
2486         font: _FontDescription = ...,
2487         foreground: _Color = ...,
2488         height: _ScreenUnits = ...,
2489         highlightbackground: _Color = ...,
2490         highlightcolor: _Color = ...,
2491         highlightthickness: _ScreenUnits = ...,
2492         image: _ImageSpec = ...,
2493         indicatoron: bool = ...,
2494         justify: Literal["left", "center", "right"] = ...,
2495         offrelief: _Relief = ...,
2496         overrelief: _Relief = ...,
2497         padx: _ScreenUnits = ...,
2498         pady: _ScreenUnits = ...,
2499         relief: _Relief = ...,
2500         selectcolor: _Color = ...,
2501         selectimage: _ImageSpec = ...,
2502         state: Literal["normal", "active", "disabled"] = ...,
2503         takefocus: _TakeFocusValue = ...,
2504         text: float | str = ...,
2505         textvariable: Variable = ...,
2506         tristateimage: _ImageSpec = ...,
2507         tristatevalue: Any = ...,
2508         underline: int = ...,
2509         value: Any = ...,
2510         variable: Variable | Literal[""] = ...,
2511         width: _ScreenUnits = ...,
2512         wraplength: _ScreenUnits = ...,
2513     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2514     @overload
2515     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2516     config = configure
2517     def deselect(self): ...
2518     def flash(self): ...
2519     def invoke(self) -> Any: ...
2520     def select(self): ...
2521
2522 class Scale(Widget):
2523     def __init__(
2524         self,
2525         master: Misc | None = ...,
2526         cnf: dict[str, Any] | None = ...,
2527         *,
2528         activebackground: _Color = ...,
2529         background: _Color = ...,
2530         bd: _ScreenUnits = ...,
2531         bg: _Color = ...,
2532         bigincrement: float = ...,
2533         border: _ScreenUnits = ...,
2534         borderwidth: _ScreenUnits = ...,
2535         # don't know why the callback gets string instead of float
2536         command: str | Callable[[str], Any] = ...,
2537         cursor: _Cursor = ...,
2538         digits: int = ...,
2539         fg: _Color = ...,
2540         font: _FontDescription = ...,
2541         foreground: _Color = ...,
2542         from_: float = ...,
2543         highlightbackground: _Color = ...,
2544         highlightcolor: _Color = ...,
2545         highlightthickness: _ScreenUnits = ...,
2546         label: str = ...,
2547         length: _ScreenUnits = ...,
2548         name: str = ...,
2549         orient: Literal["horizontal", "vertical"] = ...,
2550         relief: _Relief = ...,
2551         repeatdelay: int = ...,
2552         repeatinterval: int = ...,
2553         resolution: float = ...,
2554         showvalue: bool = ...,
2555         sliderlength: _ScreenUnits = ...,
2556         sliderrelief: _Relief = ...,
2557         state: Literal["normal", "active", "disabled"] = ...,
2558         takefocus: _TakeFocusValue = ...,
2559         tickinterval: float = ...,
2560         to: float = ...,
2561         troughcolor: _Color = ...,
2562         variable: IntVar | DoubleVar = ...,
2563         width: _ScreenUnits = ...,
2564     ) -> None: ...
2565     @overload
2566     def configure(
2567         self,
2568         cnf: dict[str, Any] | None = ...,
2569         *,
2570         activebackground: _Color = ...,
2571         background: _Color = ...,
2572         bd: _ScreenUnits = ...,
2573         bg: _Color = ...,
2574         bigincrement: float = ...,
2575         border: _ScreenUnits = ...,
2576         borderwidth: _ScreenUnits = ...,
2577         command: str | Callable[[str], Any] = ...,
2578         cursor: _Cursor = ...,
2579         digits: int = ...,
2580         fg: _Color = ...,
2581         font: _FontDescription = ...,
2582         foreground: _Color = ...,
2583         from_: float = ...,
2584         highlightbackground: _Color = ...,
2585         highlightcolor: _Color = ...,
2586         highlightthickness: _ScreenUnits = ...,
2587         label: str = ...,
2588         length: _ScreenUnits = ...,
2589         orient: Literal["horizontal", "vertical"] = ...,
2590         relief: _Relief = ...,
2591         repeatdelay: int = ...,
2592         repeatinterval: int = ...,
2593         resolution: float = ...,
2594         showvalue: bool = ...,
2595         sliderlength: _ScreenUnits = ...,
2596         sliderrelief: _Relief = ...,
2597         state: Literal["normal", "active", "disabled"] = ...,
2598         takefocus: _TakeFocusValue = ...,
2599         tickinterval: float = ...,
2600         to: float = ...,
2601         troughcolor: _Color = ...,
2602         variable: IntVar | DoubleVar = ...,
2603         width: _ScreenUnits = ...,
2604     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2605     @overload
2606     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2607     config = configure
2608     def get(self): ...
2609     def set(self, value): ...
2610     def coords(self, value: Any | None = ...): ...
2611     def identify(self, x, y): ...
2612
2613 class Scrollbar(Widget):
2614     def __init__(
2615         self,
2616         master: Misc | None = ...,
2617         cnf: dict[str, Any] | None = ...,
2618         *,
2619         activebackground: _Color = ...,
2620         activerelief: _Relief = ...,
2621         background: _Color = ...,
2622         bd: _ScreenUnits = ...,
2623         bg: _Color = ...,
2624         border: _ScreenUnits = ...,
2625         borderwidth: _ScreenUnits = ...,
2626         # There are many ways how the command may get called. Search for
2627         # 'SCROLLING COMMANDS' in scrollbar man page. There doesn't seem to
2628         # be any way to specify an overloaded callback function, so we say
2629         # that it can take any args while it can't in reality.
2630         command: Callable[..., tuple[float, float] | None] | str = ...,
2631         cursor: _Cursor = ...,
2632         elementborderwidth: _ScreenUnits = ...,
2633         highlightbackground: _Color = ...,
2634         highlightcolor: _Color = ...,
2635         highlightthickness: _ScreenUnits = ...,
2636         jump: bool = ...,
2637         name: str = ...,
2638         orient: Literal["horizontal", "vertical"] = ...,
2639         relief: _Relief = ...,
2640         repeatdelay: int = ...,
2641         repeatinterval: int = ...,
2642         takefocus: _TakeFocusValue = ...,
2643         troughcolor: _Color = ...,
2644         width: _ScreenUnits = ...,
2645     ) -> None: ...
2646     @overload
2647     def configure(
2648         self,
2649         cnf: dict[str, Any] | None = ...,
2650         *,
2651         activebackground: _Color = ...,
2652         activerelief: _Relief = ...,
2653         background: _Color = ...,
2654         bd: _ScreenUnits = ...,
2655         bg: _Color = ...,
2656         border: _ScreenUnits = ...,
2657         borderwidth: _ScreenUnits = ...,
2658         command: Callable[..., tuple[float, float] | None] | str = ...,
2659         cursor: _Cursor = ...,
2660         elementborderwidth: _ScreenUnits = ...,
2661         highlightbackground: _Color = ...,
2662         highlightcolor: _Color = ...,
2663         highlightthickness: _ScreenUnits = ...,
2664         jump: bool = ...,
2665         orient: Literal["horizontal", "vertical"] = ...,
2666         relief: _Relief = ...,
2667         repeatdelay: int = ...,
2668         repeatinterval: int = ...,
2669         takefocus: _TakeFocusValue = ...,
2670         troughcolor: _Color = ...,
2671         width: _ScreenUnits = ...,
2672     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2673     @overload
2674     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2675     config = configure
2676     def activate(self, index: Any | None = ...): ...
2677     def delta(self, deltax, deltay): ...
2678     def fraction(self, x, y): ...
2679     def identify(self, x, y): ...
2680     def get(self): ...
2681     def set(self, first, last): ...
2682
2683 _TextIndex = Union[_tkinter.Tcl_Obj, str, float, Misc]
2684
2685 class Text(Widget, XView, YView):
2686     def __init__(
2687         self,
2688         master: Misc | None = ...,
2689         cnf: dict[str, Any] | None = ...,
2690         *,
2691         autoseparators: bool = ...,
2692         background: _Color = ...,
2693         bd: _ScreenUnits = ...,
2694         bg: _Color = ...,
2695         blockcursor: bool = ...,
2696         border: _ScreenUnits = ...,
2697         borderwidth: _ScreenUnits = ...,
2698         cursor: _Cursor = ...,
2699         endline: int | Literal[""] = ...,
2700         exportselection: bool = ...,
2701         fg: _Color = ...,
2702         font: _FontDescription = ...,
2703         foreground: _Color = ...,
2704         # width is always int, but height is allowed to be ScreenUnits.
2705         # This doesn't make any sense to me, and this isn't documented.
2706         # The docs seem to say that both should be integers.
2707         height: _ScreenUnits = ...,
2708         highlightbackground: _Color = ...,
2709         highlightcolor: _Color = ...,
2710         highlightthickness: _ScreenUnits = ...,
2711         inactiveselectbackground: _Color = ...,
2712         insertbackground: _Color = ...,
2713         insertborderwidth: _ScreenUnits = ...,
2714         insertofftime: int = ...,
2715         insertontime: int = ...,
2716         insertunfocussed: Literal["none", "hollow", "solid"] = ...,
2717         insertwidth: _ScreenUnits = ...,
2718         maxundo: int = ...,
2719         name: str = ...,
2720         padx: _ScreenUnits = ...,
2721         pady: _ScreenUnits = ...,
2722         relief: _Relief = ...,
2723         selectbackground: _Color = ...,
2724         selectborderwidth: _ScreenUnits = ...,
2725         selectforeground: _Color = ...,
2726         setgrid: bool = ...,
2727         spacing1: _ScreenUnits = ...,
2728         spacing2: _ScreenUnits = ...,
2729         spacing3: _ScreenUnits = ...,
2730         startline: int | Literal[""] = ...,
2731         state: Literal["normal", "disabled"] = ...,
2732         # Literal inside Tuple doesn't actually work
2733         tabs: _ScreenUnits | str | Tuple[_ScreenUnits | str, ...] = ...,
2734         tabstyle: Literal["tabular", "wordprocessor"] = ...,
2735         takefocus: _TakeFocusValue = ...,
2736         undo: bool = ...,
2737         width: int = ...,
2738         wrap: Literal["none", "char", "word"] = ...,
2739         xscrollcommand: _XYScrollCommand = ...,
2740         yscrollcommand: _XYScrollCommand = ...,
2741     ) -> None: ...
2742     @overload
2743     def configure(
2744         self,
2745         cnf: dict[str, Any] | None = ...,
2746         *,
2747         autoseparators: bool = ...,
2748         background: _Color = ...,
2749         bd: _ScreenUnits = ...,
2750         bg: _Color = ...,
2751         blockcursor: bool = ...,
2752         border: _ScreenUnits = ...,
2753         borderwidth: _ScreenUnits = ...,
2754         cursor: _Cursor = ...,
2755         endline: int | Literal[""] = ...,
2756         exportselection: bool = ...,
2757         fg: _Color = ...,
2758         font: _FontDescription = ...,
2759         foreground: _Color = ...,
2760         height: _ScreenUnits = ...,
2761         highlightbackground: _Color = ...,
2762         highlightcolor: _Color = ...,
2763         highlightthickness: _ScreenUnits = ...,
2764         inactiveselectbackground: _Color = ...,
2765         insertbackground: _Color = ...,
2766         insertborderwidth: _ScreenUnits = ...,
2767         insertofftime: int = ...,
2768         insertontime: int = ...,
2769         insertunfocussed: Literal["none", "hollow", "solid"] = ...,
2770         insertwidth: _ScreenUnits = ...,
2771         maxundo: int = ...,
2772         padx: _ScreenUnits = ...,
2773         pady: _ScreenUnits = ...,
2774         relief: _Relief = ...,
2775         selectbackground: _Color = ...,
2776         selectborderwidth: _ScreenUnits = ...,
2777         selectforeground: _Color = ...,
2778         setgrid: bool = ...,
2779         spacing1: _ScreenUnits = ...,
2780         spacing2: _ScreenUnits = ...,
2781         spacing3: _ScreenUnits = ...,
2782         startline: int | Literal[""] = ...,
2783         state: Literal["normal", "disabled"] = ...,
2784         tabs: _ScreenUnits | str | Tuple[_ScreenUnits | str, ...] = ...,
2785         tabstyle: Literal["tabular", "wordprocessor"] = ...,
2786         takefocus: _TakeFocusValue = ...,
2787         undo: bool = ...,
2788         width: int = ...,
2789         wrap: Literal["none", "char", "word"] = ...,
2790         xscrollcommand: _XYScrollCommand = ...,
2791         yscrollcommand: _XYScrollCommand = ...,
2792     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2793     @overload
2794     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2795     config = configure
2796     def bbox(self, index: _TextIndex) -> tuple[int, int, int, int] | None: ...  # type: ignore
2797     def compare(self, index1: _TextIndex, op: Literal["<", "<=", "==", ">=", ">", "!="], index2: _TextIndex) -> bool: ...
2798     def count(self, index1, index2, *args): ...  # TODO
2799     @overload
2800     def debug(self, boolean: None = ...) -> bool: ...
2801     @overload
2802     def debug(self, boolean: bool) -> None: ...
2803     def delete(self, index1: _TextIndex, index2: _TextIndex | None = ...) -> None: ...
2804     def dlineinfo(self, index: _TextIndex) -> tuple[int, int, int, int, int] | None: ...
2805     @overload
2806     def dump(
2807         self,
2808         index1: _TextIndex,
2809         index2: _TextIndex | None = ...,
2810         command: None = ...,
2811         *,
2812         all: bool = ...,
2813         image: bool = ...,
2814         mark: bool = ...,
2815         tag: bool = ...,
2816         text: bool = ...,
2817         window: bool = ...,
2818     ) -> list[tuple[str, str, str]]: ...
2819     @overload
2820     def dump(
2821         self,
2822         index1: _TextIndex,
2823         index2: _TextIndex | None,
2824         command: Callable[[str, str, str], Any] | str,
2825         *,
2826         all: bool = ...,
2827         image: bool = ...,
2828         mark: bool = ...,
2829         tag: bool = ...,
2830         text: bool = ...,
2831         window: bool = ...,
2832     ) -> None: ...
2833     @overload
2834     def dump(
2835         self,
2836         index1: _TextIndex,
2837         index2: _TextIndex | None = ...,
2838         *,
2839         command: Callable[[str, str, str], Any] | str,
2840         all: bool = ...,
2841         image: bool = ...,
2842         mark: bool = ...,
2843         tag: bool = ...,
2844         text: bool = ...,
2845         window: bool = ...,
2846     ) -> None: ...
2847     def edit(self, *args): ...  # docstring says "Internal method"
2848     @overload
2849     def edit_modified(self, arg: None = ...) -> bool: ...  # actually returns Literal[0, 1]
2850     @overload
2851     def edit_modified(self, arg: bool) -> None: ...  # actually returns empty string
2852     def edit_redo(self) -> None: ...  # actually returns empty string
2853     def edit_reset(self) -> None: ...  # actually returns empty string
2854     def edit_separator(self) -> None: ...  # actually returns empty string
2855     def edit_undo(self) -> None: ...  # actually returns empty string
2856     def get(self, index1: _TextIndex, index2: _TextIndex | None = ...) -> str: ...
2857     # TODO: image_* methods
2858     def image_cget(self, index, option): ...
2859     def image_configure(self, index, cnf: Any | None = ..., **kw): ...
2860     def image_create(self, index, cnf=..., **kw): ...
2861     def image_names(self): ...
2862     def index(self, index: _TextIndex) -> str: ...
2863     def insert(self, index: _TextIndex, chars: str, *args: str | list[str] | Tuple[str, ...]) -> None: ...
2864     @overload
2865     def mark_gravity(self, markName: str, direction: None = ...) -> Literal["left", "right"]: ...
2866     @overload
2867     def mark_gravity(self, markName: str, direction: Literal["left", "right"]) -> None: ...  # actually returns empty string
2868     def mark_names(self) -> Tuple[str, ...]: ...
2869     def mark_set(self, markName: str, index: _TextIndex) -> None: ...
2870     def mark_unset(self, *markNames: str) -> None: ...
2871     def mark_next(self, index: _TextIndex) -> str | None: ...
2872     def mark_previous(self, index: _TextIndex) -> str | None: ...
2873     # **kw of peer_create is same as the kwargs of Text.__init__
2874     def peer_create(self, newPathName: str | Text, cnf: dict[str, Any] = ..., **kw: Any) -> None: ...
2875     def peer_names(self) -> Tuple[_tkinter.Tcl_Obj, ...]: ...
2876     def replace(self, index1: _TextIndex, index2: _TextIndex, chars: str, *args: str | list[str] | Tuple[str, ...]) -> None: ...
2877     def scan_mark(self, x: int, y: int) -> None: ...
2878     def scan_dragto(self, x: int, y: int) -> None: ...
2879     def search(
2880         self,
2881         pattern: str,
2882         index: _TextIndex,
2883         stopindex: _TextIndex | None = ...,
2884         forwards: bool | None = ...,
2885         backwards: bool | None = ...,
2886         exact: bool | None = ...,
2887         regexp: bool | None = ...,
2888         nocase: bool | None = ...,
2889         count: Variable | None = ...,
2890         elide: bool | None = ...,
2891     ) -> str: ...  # returns empty string for not found
2892     def see(self, index: _TextIndex) -> None: ...
2893     def tag_add(self, tagName: str, index1: _TextIndex, *args: _TextIndex) -> None: ...
2894     # tag_bind stuff is very similar to Canvas
2895     @overload
2896     def tag_bind(
2897         self,
2898         tagName: str,
2899         sequence: str | None,
2900         func: Callable[[Event[Text]], Any] | None,
2901         add: Literal["", "+"] | bool | None = ...,
2902     ) -> str: ...
2903     @overload
2904     def tag_bind(self, tagName: str, sequence: str | None, func: str, add: Literal["", "+"] | bool | None = ...) -> None: ...
2905     def tag_unbind(self, tagName: str, sequence: str, funcid: str | None = ...) -> None: ...
2906     # allowing any string for cget instead of just Literals because there's no other way to look up tag options
2907     def tag_cget(self, tagName: str, option: str) -> Any: ...
2908     @overload
2909     def tag_configure(
2910         self,
2911         tagName: str,
2912         cnf: dict[str, Any] | None = ...,
2913         *,
2914         background: _Color = ...,
2915         bgstipple: _Bitmap = ...,
2916         borderwidth: _ScreenUnits = ...,
2917         border: _ScreenUnits = ...,  # alias for borderwidth
2918         elide: bool = ...,
2919         fgstipple: _Bitmap = ...,
2920         font: _FontDescription = ...,
2921         foreground: _Color = ...,
2922         justify: Literal["left", "right", "center"] = ...,
2923         lmargin1: _ScreenUnits = ...,
2924         lmargin2: _ScreenUnits = ...,
2925         lmargincolor: _Color = ...,
2926         offset: _ScreenUnits = ...,
2927         overstrike: bool = ...,
2928         overstrikefg: _Color = ...,
2929         relief: _Relief = ...,
2930         rmargin: _ScreenUnits = ...,
2931         rmargincolor: _Color = ...,
2932         selectbackground: _Color = ...,
2933         selectforeground: _Color = ...,
2934         spacing1: _ScreenUnits = ...,
2935         spacing2: _ScreenUnits = ...,
2936         spacing3: _ScreenUnits = ...,
2937         tabs: Any = ...,  # the exact type is kind of complicated, see manual page
2938         tabstyle: Literal["tabular", "wordprocessor"] = ...,
2939         underline: bool = ...,
2940         underlinefg: _Color = ...,
2941         wrap: Literal["none", "char", "word"] = ...,  # be careful with "none" vs None
2942     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
2943     @overload
2944     def tag_configure(self, tagName: str, cnf: str) -> tuple[str, str, str, Any, Any]: ...
2945     tag_config = tag_configure
2946     def tag_delete(self, __first_tag_name: str, *tagNames: str) -> None: ...  # error if no tag names given
2947     def tag_lower(self, tagName: str, belowThis: str | None = ...) -> None: ...
2948     def tag_names(self, index: _TextIndex | None = ...) -> Tuple[str, ...]: ...
2949     def tag_nextrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> tuple[str, str] | tuple[()]: ...
2950     def tag_prevrange(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> tuple[str, str] | tuple[()]: ...
2951     def tag_raise(self, tagName: str, aboveThis: str | None = ...) -> None: ...
2952     def tag_ranges(self, tagName: str) -> Tuple[_tkinter.Tcl_Obj, ...]: ...
2953     # tag_remove and tag_delete are different
2954     def tag_remove(self, tagName: str, index1: _TextIndex, index2: _TextIndex | None = ...) -> None: ...
2955     # TODO: window_* methods
2956     def window_cget(self, index, option): ...
2957     def window_configure(self, index, cnf: Any | None = ..., **kw): ...
2958     window_config = window_configure
2959     def window_create(self, index, cnf=..., **kw): ...
2960     def window_names(self): ...
2961     def yview_pickplace(self, *what): ...  # deprecated
2962
2963 class _setit:
2964     def __init__(self, var, value, callback: Any | None = ...): ...
2965     def __call__(self, *args): ...
2966
2967 # manual page: tk_optionMenu
2968 class OptionMenu(Menubutton):
2969     widgetName: Any
2970     menuname: Any
2971     def __init__(
2972         # differs from other widgets
2973         self,
2974         master: Misc | None,
2975         variable: StringVar,
2976         value: str,
2977         *values: str,
2978         # kwarg only from now on
2979         command: Callable[[StringVar], Any] | None = ...,
2980     ) -> None: ...
2981     # configure, config, cget are inherited from Menubutton
2982     # destroy and __getitem__ are overridden, signature does not change
2983
2984 class _Image(Protocol):
2985     tk: _tkinter.TkappType
2986     def height(self) -> int: ...
2987     def width(self) -> int: ...
2988
2989 class Image:
2990     name: Any
2991     tk: _tkinter.TkappType
2992     def __init__(self, imgtype, name: Any | None = ..., cnf=..., master: Misc | _tkinter.TkappType | None = ..., **kw): ...
2993     def __del__(self): ...
2994     def __setitem__(self, key, value): ...
2995     def __getitem__(self, key): ...
2996     configure: Any
2997     config: Any
2998     def height(self) -> int: ...
2999     def type(self): ...
3000     def width(self) -> int: ...
3001
3002 class PhotoImage(Image):
3003     def __init__(
3004         self,
3005         name: str | None = ...,
3006         cnf: dict[str, Any] = ...,
3007         master: Misc | _tkinter.TkappType | None = ...,
3008         *,
3009         data: str | bytes = ...,  # not same as data argument of put()
3010         format: str = ...,
3011         file: StrOrBytesPath = ...,
3012         gamma: float = ...,
3013         height: int = ...,
3014         palette: int | str = ...,
3015         width: int = ...,
3016     ) -> None: ...
3017     def configure(
3018         self,
3019         *,
3020         data: str | bytes = ...,
3021         format: str = ...,
3022         file: StrOrBytesPath = ...,
3023         gamma: float = ...,
3024         height: int = ...,
3025         palette: int | str = ...,
3026         width: int = ...,
3027     ) -> None: ...
3028     config = configure
3029     def blank(self) -> None: ...
3030     def cget(self, option: str) -> str: ...
3031     def __getitem__(self, key: str) -> str: ...  # always string: image['height'] can be '0'
3032     def copy(self) -> PhotoImage: ...
3033     def zoom(self, x: int, y: int | Literal[""] = ...) -> PhotoImage: ...
3034     def subsample(self, x: int, y: int | Literal[""] = ...) -> PhotoImage: ...
3035     def get(self, x: int, y: int) -> tuple[int, int, int]: ...
3036     def put(
3037         self,
3038         data: (
3039             str
3040             | list[str]
3041             | list[list[_Color]]
3042             | list[Tuple[_Color, ...]]
3043             | Tuple[str, ...]
3044             | Tuple[list[_Color], ...]
3045             | Tuple[Tuple[_Color, ...], ...]
3046         ),
3047         to: tuple[int, int] | None = ...,
3048     ) -> None: ...
3049     def write(self, filename: StrOrBytesPath, format: str | None = ..., from_coords: tuple[int, int] | None = ...) -> None: ...
3050     if sys.version_info >= (3, 8):
3051         def transparency_get(self, x: int, y: int) -> bool: ...
3052         def transparency_set(self, x: int, y: int, boolean: bool) -> None: ...
3053
3054 class BitmapImage(Image):
3055     def __init__(
3056         self,
3057         name: Any | None = ...,
3058         cnf: dict[str, Any] = ...,
3059         master: Misc | _tkinter.TkappType | None = ...,
3060         *,
3061         background: _Color = ...,
3062         data: str | bytes = ...,
3063         file: StrOrBytesPath = ...,
3064         foreground: _Color = ...,
3065         maskdata: str = ...,
3066         maskfile: StrOrBytesPath = ...,
3067     ) -> None: ...
3068
3069 def image_names() -> Tuple[str, ...]: ...
3070 def image_types() -> Tuple[str, ...]: ...
3071
3072 class Spinbox(Widget, XView):
3073     def __init__(
3074         self,
3075         master: Misc | None = ...,
3076         cnf: dict[str, Any] | None = ...,
3077         *,
3078         activebackground: _Color = ...,
3079         background: _Color = ...,
3080         bd: _ScreenUnits = ...,
3081         bg: _Color = ...,
3082         border: _ScreenUnits = ...,
3083         borderwidth: _ScreenUnits = ...,
3084         buttonbackground: _Color = ...,
3085         buttoncursor: _Cursor = ...,
3086         buttondownrelief: _Relief = ...,
3087         buttonuprelief: _Relief = ...,
3088         # percent substitutions don't seem to be supported, it's similar to Entry's validation stuff
3089         command: Callable[[], Any] | str | list[str] | Tuple[str, ...] = ...,
3090         cursor: _Cursor = ...,
3091         disabledbackground: _Color = ...,
3092         disabledforeground: _Color = ...,
3093         exportselection: bool = ...,
3094         fg: _Color = ...,
3095         font: _FontDescription = ...,
3096         foreground: _Color = ...,
3097         format: str = ...,
3098         from_: float = ...,
3099         highlightbackground: _Color = ...,
3100         highlightcolor: _Color = ...,
3101         highlightthickness: _ScreenUnits = ...,
3102         increment: float = ...,
3103         insertbackground: _Color = ...,
3104         insertborderwidth: _ScreenUnits = ...,
3105         insertofftime: int = ...,
3106         insertontime: int = ...,
3107         insertwidth: _ScreenUnits = ...,
3108         invalidcommand: _EntryValidateCommand = ...,
3109         invcmd: _EntryValidateCommand = ...,
3110         justify: Literal["left", "center", "right"] = ...,
3111         name: str = ...,
3112         readonlybackground: _Color = ...,
3113         relief: _Relief = ...,
3114         repeatdelay: int = ...,
3115         repeatinterval: int = ...,
3116         selectbackground: _Color = ...,
3117         selectborderwidth: _ScreenUnits = ...,
3118         selectforeground: _Color = ...,
3119         state: Literal["normal", "disabled", "readonly"] = ...,
3120         takefocus: _TakeFocusValue = ...,
3121         textvariable: Variable = ...,
3122         to: float = ...,
3123         validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
3124         validatecommand: _EntryValidateCommand = ...,
3125         vcmd: _EntryValidateCommand = ...,
3126         values: list[str] | Tuple[str, ...] = ...,
3127         width: int = ...,
3128         wrap: bool = ...,
3129         xscrollcommand: _XYScrollCommand = ...,
3130     ) -> None: ...
3131     @overload
3132     def configure(
3133         self,
3134         cnf: dict[str, Any] | None = ...,
3135         *,
3136         activebackground: _Color = ...,
3137         background: _Color = ...,
3138         bd: _ScreenUnits = ...,
3139         bg: _Color = ...,
3140         border: _ScreenUnits = ...,
3141         borderwidth: _ScreenUnits = ...,
3142         buttonbackground: _Color = ...,
3143         buttoncursor: _Cursor = ...,
3144         buttondownrelief: _Relief = ...,
3145         buttonuprelief: _Relief = ...,
3146         command: Callable[[], Any] | str | list[str] | Tuple[str, ...] = ...,
3147         cursor: _Cursor = ...,
3148         disabledbackground: _Color = ...,
3149         disabledforeground: _Color = ...,
3150         exportselection: bool = ...,
3151         fg: _Color = ...,
3152         font: _FontDescription = ...,
3153         foreground: _Color = ...,
3154         format: str = ...,
3155         from_: float = ...,
3156         highlightbackground: _Color = ...,
3157         highlightcolor: _Color = ...,
3158         highlightthickness: _ScreenUnits = ...,
3159         increment: float = ...,
3160         insertbackground: _Color = ...,
3161         insertborderwidth: _ScreenUnits = ...,
3162         insertofftime: int = ...,
3163         insertontime: int = ...,
3164         insertwidth: _ScreenUnits = ...,
3165         invalidcommand: _EntryValidateCommand = ...,
3166         invcmd: _EntryValidateCommand = ...,
3167         justify: Literal["left", "center", "right"] = ...,
3168         readonlybackground: _Color = ...,
3169         relief: _Relief = ...,
3170         repeatdelay: int = ...,
3171         repeatinterval: int = ...,
3172         selectbackground: _Color = ...,
3173         selectborderwidth: _ScreenUnits = ...,
3174         selectforeground: _Color = ...,
3175         state: Literal["normal", "disabled", "readonly"] = ...,
3176         takefocus: _TakeFocusValue = ...,
3177         textvariable: Variable = ...,
3178         to: float = ...,
3179         validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
3180         validatecommand: _EntryValidateCommand = ...,
3181         vcmd: _EntryValidateCommand = ...,
3182         values: list[str] | Tuple[str, ...] = ...,
3183         width: int = ...,
3184         wrap: bool = ...,
3185         xscrollcommand: _XYScrollCommand = ...,
3186     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
3187     @overload
3188     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
3189     config = configure
3190     def bbox(self, index): ...
3191     def delete(self, first, last: Any | None = ...): ...
3192     def get(self): ...
3193     def icursor(self, index): ...
3194     def identify(self, x, y): ...
3195     def index(self, index): ...
3196     def insert(self, index, s): ...
3197     # spinbox.invoke("asdf") gives error mentioning .invoke("none"), but it's not documented
3198     def invoke(self, element: Literal["none", "buttonup", "buttondown"]) -> Literal[""]: ...
3199     def scan(self, *args): ...
3200     def scan_mark(self, x): ...
3201     def scan_dragto(self, x): ...
3202     def selection(self, *args: Any) -> Tuple[int, ...]: ...
3203     def selection_adjust(self, index): ...
3204     def selection_clear(self): ...
3205     def selection_element(self, element: Any | None = ...): ...
3206     if sys.version_info >= (3, 8):
3207         def selection_from(self, index: int) -> None: ...
3208         def selection_present(self) -> None: ...
3209         def selection_range(self, start: int, end: int) -> None: ...
3210         def selection_to(self, index: int) -> None: ...
3211
3212 class LabelFrame(Widget):
3213     def __init__(
3214         self,
3215         master: Misc | None = ...,
3216         cnf: dict[str, Any] | None = ...,
3217         *,
3218         background: _Color = ...,
3219         bd: _ScreenUnits = ...,
3220         bg: _Color = ...,
3221         border: _ScreenUnits = ...,
3222         borderwidth: _ScreenUnits = ...,
3223         class_: str = ...,
3224         colormap: Literal["new", ""] | Misc = ...,
3225         container: bool = ...,  # undocumented
3226         cursor: _Cursor = ...,
3227         fg: _Color = ...,
3228         font: _FontDescription = ...,
3229         foreground: _Color = ...,
3230         height: _ScreenUnits = ...,
3231         highlightbackground: _Color = ...,
3232         highlightcolor: _Color = ...,
3233         highlightthickness: _ScreenUnits = ...,
3234         # 'ne' and 'en' are valid labelanchors, but only 'ne' is a valid _Anchor.
3235         labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ...,
3236         labelwidget: Misc = ...,
3237         name: str = ...,
3238         padx: _ScreenUnits = ...,
3239         pady: _ScreenUnits = ...,
3240         relief: _Relief = ...,
3241         takefocus: _TakeFocusValue = ...,
3242         text: float | str = ...,
3243         visual: str | tuple[str, int] = ...,
3244         width: _ScreenUnits = ...,
3245     ) -> None: ...
3246     @overload
3247     def configure(
3248         self,
3249         cnf: dict[str, Any] | None = ...,
3250         *,
3251         background: _Color = ...,
3252         bd: _ScreenUnits = ...,
3253         bg: _Color = ...,
3254         border: _ScreenUnits = ...,
3255         borderwidth: _ScreenUnits = ...,
3256         cursor: _Cursor = ...,
3257         fg: _Color = ...,
3258         font: _FontDescription = ...,
3259         foreground: _Color = ...,
3260         height: _ScreenUnits = ...,
3261         highlightbackground: _Color = ...,
3262         highlightcolor: _Color = ...,
3263         highlightthickness: _ScreenUnits = ...,
3264         labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ...,
3265         labelwidget: Misc = ...,
3266         padx: _ScreenUnits = ...,
3267         pady: _ScreenUnits = ...,
3268         relief: _Relief = ...,
3269         takefocus: _TakeFocusValue = ...,
3270         text: float | str = ...,
3271         width: _ScreenUnits = ...,
3272     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
3273     @overload
3274     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
3275     config = configure
3276
3277 class PanedWindow(Widget):
3278     def __init__(
3279         self,
3280         master: Misc | None = ...,
3281         cnf: dict[str, Any] | None = ...,
3282         *,
3283         background: _Color = ...,
3284         bd: _ScreenUnits = ...,
3285         bg: _Color = ...,
3286         border: _ScreenUnits = ...,
3287         borderwidth: _ScreenUnits = ...,
3288         cursor: _Cursor = ...,
3289         handlepad: _ScreenUnits = ...,
3290         handlesize: _ScreenUnits = ...,
3291         height: _ScreenUnits = ...,
3292         name: str = ...,
3293         opaqueresize: bool = ...,
3294         orient: Literal["horizontal", "vertical"] = ...,
3295         proxybackground: _Color = ...,
3296         proxyborderwidth: _ScreenUnits = ...,
3297         proxyrelief: _Relief = ...,
3298         relief: _Relief = ...,
3299         sashcursor: _Cursor = ...,
3300         sashpad: _ScreenUnits = ...,
3301         sashrelief: _Relief = ...,
3302         sashwidth: _ScreenUnits = ...,
3303         showhandle: bool = ...,
3304         width: _ScreenUnits = ...,
3305     ) -> None: ...
3306     @overload
3307     def configure(
3308         self,
3309         cnf: dict[str, Any] | None = ...,
3310         *,
3311         background: _Color = ...,
3312         bd: _ScreenUnits = ...,
3313         bg: _Color = ...,
3314         border: _ScreenUnits = ...,
3315         borderwidth: _ScreenUnits = ...,
3316         cursor: _Cursor = ...,
3317         handlepad: _ScreenUnits = ...,
3318         handlesize: _ScreenUnits = ...,
3319         height: _ScreenUnits = ...,
3320         opaqueresize: bool = ...,
3321         orient: Literal["horizontal", "vertical"] = ...,
3322         proxybackground: _Color = ...,
3323         proxyborderwidth: _ScreenUnits = ...,
3324         proxyrelief: _Relief = ...,
3325         relief: _Relief = ...,
3326         sashcursor: _Cursor = ...,
3327         sashpad: _ScreenUnits = ...,
3328         sashrelief: _Relief = ...,
3329         sashwidth: _ScreenUnits = ...,
3330         showhandle: bool = ...,
3331         width: _ScreenUnits = ...,
3332     ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
3333     @overload
3334     def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
3335     config = configure
3336     def add(self, child: Widget, **kw): ...
3337     def remove(self, child): ...
3338     forget: Any
3339     def identify(self, x, y): ...
3340     def proxy(self, *args): ...
3341     def proxy_coord(self): ...
3342     def proxy_forget(self): ...
3343     def proxy_place(self, x, y): ...
3344     def sash(self, *args): ...
3345     def sash_coord(self, index): ...
3346     def sash_mark(self, index): ...
3347     def sash_place(self, index, x, y): ...
3348     def panecget(self, child, option): ...
3349     def paneconfigure(self, tagOrId, cnf: Any | None = ..., **kw): ...
3350     paneconfig: Any
3351     def panes(self): ...