4 from tkinter.font import _FontDescription
5 from typing import Any, Callable, Tuple, Union, overload
6 from typing_extensions import Literal, TypedDict
8 def tclobjs_to_py(adict): ...
9 def setup_master(master: Any | None = ...): ...
11 # from ttk_widget (aka ttk::widget) manual page, differs from tkinter._Compound
12 _TtkCompound = Literal["text", "image", tkinter._Compound]
16 tk: _tkinter.TkappType
17 def __init__(self, master: tkinter.Misc | None = ...): ...
18 def configure(self, style, query_opt: Any | None = ..., **kw): ...
19 def map(self, style, query_opt: Any | None = ..., **kw): ...
20 def lookup(self, style, option, state: Any | None = ..., default: Any | None = ...): ...
21 def layout(self, style, layoutspec: Any | None = ...): ...
22 def element_create(self, elementname, etype, *args, **kw): ...
23 def element_names(self): ...
24 def element_options(self, elementname): ...
25 def theme_create(self, themename, parent: Any | None = ..., settings: Any | None = ...): ...
26 def theme_settings(self, themename, settings): ...
27 def theme_names(self) -> Tuple[str, ...]: ...
29 def theme_use(self, themename: str) -> None: ...
31 def theme_use(self, themename: None = ...) -> str: ...
33 class Widget(tkinter.Widget):
34 def __init__(self, master: tkinter.Misc | None, widgetname, kw: Any | None = ...): ...
35 def identify(self, x, y): ...
36 def instate(self, statespec, callback: Any | None = ..., *args, **kw): ...
37 def state(self, statespec: Any | None = ...): ...
42 master: tkinter.Misc | None = ...,
45 command: tkinter._ButtonCommand = ...,
46 compound: _TtkCompound = ...,
47 cursor: tkinter._Cursor = ...,
48 default: Literal["normal", "active", "disabled"] = ...,
49 image: tkinter._ImageSpec = ...,
51 padding: Any = ..., # undocumented
54 takefocus: tkinter._TakeFocusValue = ...,
55 text: float | str = ...,
56 textvariable: tkinter.Variable = ...,
58 width: int | Literal[""] = ...,
63 cnf: dict[str, Any] | None = ...,
65 command: tkinter._ButtonCommand = ...,
66 compound: _TtkCompound = ...,
67 cursor: tkinter._Cursor = ...,
68 default: Literal["normal", "active", "disabled"] = ...,
69 image: tkinter._ImageSpec = ...,
73 takefocus: tkinter._TakeFocusValue = ...,
74 text: float | str = ...,
75 textvariable: tkinter.Variable = ...,
77 width: int | Literal[""] = ...,
78 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
80 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
82 def invoke(self) -> Any: ...
84 class Checkbutton(Widget):
87 master: tkinter.Misc | None = ...,
90 command: tkinter._ButtonCommand = ...,
91 compound: _TtkCompound = ...,
92 cursor: tkinter._Cursor = ...,
93 image: tkinter._ImageSpec = ...,
97 padding: Any = ..., # undocumented
100 takefocus: tkinter._TakeFocusValue = ...,
101 text: float | str = ...,
102 textvariable: tkinter.Variable = ...,
103 underline: int = ...,
104 # Seems like variable can be empty string, but actually setting it to
105 # empty string segfaults before Tcl 8.6.9. Search for ttk::checkbutton
106 # here: https://sourceforge.net/projects/tcl/files/Tcl/8.6.9/tcltk-release-notes-8.6.9.txt/view
107 variable: tkinter.Variable = ...,
108 width: int | Literal[""] = ...,
113 cnf: dict[str, Any] | None = ...,
115 command: tkinter._ButtonCommand = ...,
116 compound: _TtkCompound = ...,
117 cursor: tkinter._Cursor = ...,
118 image: tkinter._ImageSpec = ...,
124 takefocus: tkinter._TakeFocusValue = ...,
125 text: float | str = ...,
126 textvariable: tkinter.Variable = ...,
127 underline: int = ...,
128 variable: tkinter.Variable = ...,
129 width: int | Literal[""] = ...,
130 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
132 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
134 def invoke(self) -> Any: ...
136 class Entry(Widget, tkinter.Entry):
139 master: tkinter.Misc | None = ...,
140 widget: str | None = ...,
142 background: tkinter._Color = ..., # undocumented
144 cursor: tkinter._Cursor = ...,
145 exportselection: bool = ...,
146 font: _FontDescription = ...,
147 foreground: tkinter._Color = ...,
148 invalidcommand: tkinter._EntryValidateCommand = ...,
149 justify: Literal["left", "center", "right"] = ...,
154 takefocus: tkinter._TakeFocusValue = ...,
155 textvariable: tkinter.Variable = ...,
156 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
157 validatecommand: tkinter._EntryValidateCommand = ...,
159 xscrollcommand: tkinter._XYScrollCommand = ...,
161 @overload # type: ignore
164 cnf: dict[str, Any] | None = ...,
166 background: tkinter._Color = ...,
167 cursor: tkinter._Cursor = ...,
168 exportselection: bool = ...,
169 font: _FontDescription = ...,
170 foreground: tkinter._Color = ...,
171 invalidcommand: tkinter._EntryValidateCommand = ...,
172 justify: Literal["left", "center", "right"] = ...,
176 takefocus: tkinter._TakeFocusValue = ...,
177 textvariable: tkinter.Variable = ...,
178 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
179 validatecommand: tkinter._EntryValidateCommand = ...,
181 xscrollcommand: tkinter._XYScrollCommand = ...,
182 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
184 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
185 # config must be copy/pasted, otherwise ttk.Entry().config is mypy error (don't know why)
186 @overload # type: ignore
189 cnf: dict[str, Any] | None = ...,
191 background: tkinter._Color = ...,
192 cursor: tkinter._Cursor = ...,
193 exportselection: bool = ...,
194 font: _FontDescription = ...,
195 foreground: tkinter._Color = ...,
196 invalidcommand: tkinter._EntryValidateCommand = ...,
197 justify: Literal["left", "center", "right"] = ...,
201 takefocus: tkinter._TakeFocusValue = ...,
202 textvariable: tkinter.Variable = ...,
203 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
204 validatecommand: tkinter._EntryValidateCommand = ...,
206 xscrollcommand: tkinter._XYScrollCommand = ...,
207 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
209 def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
210 def bbox(self, index): ...
211 def identify(self, x, y): ...
212 def validate(self): ...
214 class Combobox(Entry):
217 master: tkinter.Misc | None = ...,
219 background: tkinter._Color = ..., # undocumented
221 cursor: tkinter._Cursor = ...,
222 exportselection: bool = ...,
223 font: _FontDescription = ..., # undocumented
224 foreground: tkinter._Color = ..., # undocumented
226 invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented
227 justify: Literal["left", "center", "right"] = ...,
229 postcommand: Callable[[], Any] | str = ...,
230 show: Any = ..., # undocumented
233 takefocus: tkinter._TakeFocusValue = ...,
234 textvariable: tkinter.Variable = ...,
235 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ..., # undocumented
236 validatecommand: tkinter._EntryValidateCommand = ..., # undocumented
237 values: list[str] | Tuple[str, ...] = ...,
239 xscrollcommand: tkinter._XYScrollCommand = ..., # undocumented
241 @overload # type: ignore
244 cnf: dict[str, Any] | None = ...,
246 background: tkinter._Color = ...,
247 cursor: tkinter._Cursor = ...,
248 exportselection: bool = ...,
249 font: _FontDescription = ...,
250 foreground: tkinter._Color = ...,
252 invalidcommand: tkinter._EntryValidateCommand = ...,
253 justify: Literal["left", "center", "right"] = ...,
254 postcommand: Callable[[], Any] | str = ...,
258 takefocus: tkinter._TakeFocusValue = ...,
259 textvariable: tkinter.Variable = ...,
260 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
261 validatecommand: tkinter._EntryValidateCommand = ...,
262 values: list[str] | Tuple[str, ...] = ...,
264 xscrollcommand: tkinter._XYScrollCommand = ...,
265 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
267 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
268 # config must be copy/pasted, otherwise ttk.Combobox().config is mypy error (don't know why)
269 @overload # type: ignore
272 cnf: dict[str, Any] | None = ...,
274 background: tkinter._Color = ...,
275 cursor: tkinter._Cursor = ...,
276 exportselection: bool = ...,
277 font: _FontDescription = ...,
278 foreground: tkinter._Color = ...,
280 invalidcommand: tkinter._EntryValidateCommand = ...,
281 justify: Literal["left", "center", "right"] = ...,
282 postcommand: Callable[[], Any] | str = ...,
286 takefocus: tkinter._TakeFocusValue = ...,
287 textvariable: tkinter.Variable = ...,
288 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
289 validatecommand: tkinter._EntryValidateCommand = ...,
290 values: list[str] | Tuple[str, ...] = ...,
292 xscrollcommand: tkinter._XYScrollCommand = ...,
293 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
295 def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
296 def current(self, newindex: Any | None = ...): ...
297 def set(self, value): ...
302 master: tkinter.Misc | None = ...,
304 border: tkinter._ScreenUnits = ...,
305 borderwidth: tkinter._ScreenUnits = ...,
307 cursor: tkinter._Cursor = ...,
308 height: tkinter._ScreenUnits = ...,
310 padding: tkinter._Padding = ...,
311 relief: tkinter._Relief = ...,
313 takefocus: tkinter._TakeFocusValue = ...,
314 width: tkinter._ScreenUnits = ...,
319 cnf: dict[str, Any] | None = ...,
321 border: tkinter._ScreenUnits = ...,
322 borderwidth: tkinter._ScreenUnits = ...,
323 cursor: tkinter._Cursor = ...,
324 height: tkinter._ScreenUnits = ...,
325 padding: tkinter._Padding = ...,
326 relief: tkinter._Relief = ...,
328 takefocus: tkinter._TakeFocusValue = ...,
329 width: tkinter._ScreenUnits = ...,
330 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
332 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
338 master: tkinter.Misc | None = ...,
340 anchor: tkinter._Anchor = ...,
341 background: tkinter._Color = ...,
342 border: tkinter._ScreenUnits = ..., # alias for borderwidth
343 borderwidth: tkinter._ScreenUnits = ..., # undocumented
345 compound: _TtkCompound = ...,
346 cursor: tkinter._Cursor = ...,
347 font: _FontDescription = ...,
348 foreground: tkinter._Color = ...,
349 image: tkinter._ImageSpec = ...,
350 justify: Literal["left", "center", "right"] = ...,
352 padding: tkinter._Padding = ...,
353 relief: tkinter._Relief = ...,
356 takefocus: tkinter._TakeFocusValue = ...,
357 text: float | str = ...,
358 textvariable: tkinter.Variable = ...,
359 underline: int = ...,
360 width: int | Literal[""] = ...,
361 wraplength: tkinter._ScreenUnits = ...,
366 cnf: dict[str, Any] | None = ...,
368 anchor: tkinter._Anchor = ...,
369 background: tkinter._Color = ...,
370 border: tkinter._ScreenUnits = ...,
371 borderwidth: tkinter._ScreenUnits = ...,
372 compound: _TtkCompound = ...,
373 cursor: tkinter._Cursor = ...,
374 font: _FontDescription = ...,
375 foreground: tkinter._Color = ...,
376 image: tkinter._ImageSpec = ...,
377 justify: Literal["left", "center", "right"] = ...,
378 padding: tkinter._Padding = ...,
379 relief: tkinter._Relief = ...,
382 takefocus: tkinter._TakeFocusValue = ...,
383 text: float | str = ...,
384 textvariable: tkinter.Variable = ...,
385 underline: int = ...,
386 width: int | Literal[""] = ...,
387 wraplength: tkinter._ScreenUnits = ...,
388 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
390 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
393 class Labelframe(Widget):
396 master: tkinter.Misc | None = ...,
398 border: tkinter._ScreenUnits = ...,
399 borderwidth: tkinter._ScreenUnits = ..., # undocumented
401 cursor: tkinter._Cursor = ...,
402 height: tkinter._ScreenUnits = ...,
403 labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ...,
404 labelwidget: tkinter.Misc = ...,
406 padding: tkinter._Padding = ...,
407 relief: tkinter._Relief = ..., # undocumented
409 takefocus: tkinter._TakeFocusValue = ...,
410 text: float | str = ...,
411 underline: int = ...,
412 width: tkinter._ScreenUnits = ...,
417 cnf: dict[str, Any] | None = ...,
419 border: tkinter._ScreenUnits = ...,
420 borderwidth: tkinter._ScreenUnits = ...,
421 cursor: tkinter._Cursor = ...,
422 height: tkinter._ScreenUnits = ...,
423 labelanchor: Literal["nw", "n", "ne", "en", "e", "es", "se", "s", "sw", "ws", "w", "wn"] = ...,
424 labelwidget: tkinter.Misc = ...,
425 padding: tkinter._Padding = ...,
426 relief: tkinter._Relief = ...,
428 takefocus: tkinter._TakeFocusValue = ...,
429 text: float | str = ...,
430 underline: int = ...,
431 width: tkinter._ScreenUnits = ...,
432 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
434 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
437 LabelFrame = Labelframe
439 class Menubutton(Widget):
442 master: tkinter.Misc | None = ...,
445 compound: _TtkCompound = ...,
446 cursor: tkinter._Cursor = ...,
447 direction: Literal["above", "below", "left", "right", "flush"] = ...,
448 image: tkinter._ImageSpec = ...,
449 menu: tkinter.Menu = ...,
451 padding: Any = ..., # undocumented
454 takefocus: tkinter._TakeFocusValue = ...,
455 text: float | str = ...,
456 textvariable: tkinter.Variable = ...,
457 underline: int = ...,
458 width: int | Literal[""] = ...,
463 cnf: dict[str, Any] | None = ...,
465 compound: _TtkCompound = ...,
466 cursor: tkinter._Cursor = ...,
467 direction: Literal["above", "below", "left", "right", "flush"] = ...,
468 image: tkinter._ImageSpec = ...,
469 menu: tkinter.Menu = ...,
473 takefocus: tkinter._TakeFocusValue = ...,
474 text: float | str = ...,
475 textvariable: tkinter.Variable = ...,
476 underline: int = ...,
477 width: int | Literal[""] = ...,
478 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
480 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
483 class Notebook(Widget):
486 master: tkinter.Misc | None = ...,
489 cursor: tkinter._Cursor = ...,
492 padding: tkinter._Padding = ...,
494 takefocus: tkinter._TakeFocusValue = ...,
500 cnf: dict[str, Any] | None = ...,
502 cursor: tkinter._Cursor = ...,
504 padding: tkinter._Padding = ...,
506 takefocus: tkinter._TakeFocusValue = ...,
508 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
510 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
514 child: tkinter.Widget,
516 state: Literal["normal", "disabled", "hidden"] = ...,
517 sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty
518 padding: tkinter._Padding = ...,
520 image: Any = ..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name)
521 compound: tkinter._Compound = ...,
522 underline: int = ...,
524 def forget(self, tab_id): ...
525 def hide(self, tab_id): ...
526 def identify(self, x, y): ...
527 def index(self, tab_id): ...
528 def insert(self, pos, child, **kw): ...
529 def select(self, tab_id: Any | None = ...): ...
530 def tab(self, tab_id, option: Any | None = ..., **kw): ...
532 def enable_traversal(self) -> None: ...
534 class Panedwindow(Widget, tkinter.PanedWindow):
537 master: tkinter.Misc | None = ...,
540 cursor: tkinter._Cursor = ...,
541 # width and height for tkinter.ttk.Panedwindow are int but for tkinter.PanedWindow they are screen units
544 orient: Literal["vertical", "horizontal"] = ...,
546 takefocus: tkinter._TakeFocusValue = ...,
549 def add(self, child: tkinter.Widget, *, weight: int = ..., **kw) -> None: ...
550 @overload # type: ignore
553 cnf: dict[str, Any] | None = ...,
555 cursor: tkinter._Cursor = ...,
558 takefocus: tkinter._TakeFocusValue = ...,
560 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
562 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
563 # config must be copy/pasted, otherwise ttk.Panedwindow().config is mypy error (don't know why)
564 @overload # type: ignore
567 cnf: dict[str, Any] | None = ...,
569 cursor: tkinter._Cursor = ...,
572 takefocus: tkinter._TakeFocusValue = ...,
574 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
576 def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
578 def insert(self, pos, child, **kw): ...
579 def pane(self, pane, option: Any | None = ..., **kw): ...
580 def sashpos(self, index, newpos: Any | None = ...): ...
582 PanedWindow = Panedwindow
584 class Progressbar(Widget):
587 master: tkinter.Misc | None = ...,
590 cursor: tkinter._Cursor = ...,
591 length: tkinter._ScreenUnits = ...,
592 maximum: float = ...,
593 mode: Literal["determinate", "indeterminate"] = ...,
595 orient: Literal["horizontal", "vertical"] = ...,
596 phase: int = ..., # docs say read-only but assigning int to this works
598 takefocus: tkinter._TakeFocusValue = ...,
600 variable: tkinter.IntVar | tkinter.DoubleVar = ...,
605 cnf: dict[str, Any] | None = ...,
607 cursor: tkinter._Cursor = ...,
608 length: tkinter._ScreenUnits = ...,
609 maximum: float = ...,
610 mode: Literal["determinate", "indeterminate"] = ...,
611 orient: Literal["horizontal", "vertical"] = ...,
614 takefocus: tkinter._TakeFocusValue = ...,
616 variable: tkinter.IntVar | tkinter.DoubleVar = ...,
617 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
619 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
621 def start(self, interval: Any | None = ...): ...
622 def step(self, amount: Any | None = ...): ...
625 class Radiobutton(Widget):
628 master: tkinter.Misc | None = ...,
631 command: tkinter._ButtonCommand = ...,
632 compound: _TtkCompound = ...,
633 cursor: tkinter._Cursor = ...,
634 image: tkinter._ImageSpec = ...,
636 padding: Any = ..., # undocumented
639 takefocus: tkinter._TakeFocusValue = ...,
640 text: float | str = ...,
641 textvariable: tkinter.Variable = ...,
642 underline: int = ...,
644 variable: tkinter.Variable | Literal[""] = ...,
645 width: int | Literal[""] = ...,
650 cnf: dict[str, Any] | None = ...,
652 command: tkinter._ButtonCommand = ...,
653 compound: _TtkCompound = ...,
654 cursor: tkinter._Cursor = ...,
655 image: tkinter._ImageSpec = ...,
659 takefocus: tkinter._TakeFocusValue = ...,
660 text: float | str = ...,
661 textvariable: tkinter.Variable = ...,
662 underline: int = ...,
664 variable: tkinter.Variable | Literal[""] = ...,
665 width: int | Literal[""] = ...,
666 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
668 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
670 def invoke(self) -> Any: ...
672 class Scale(Widget, tkinter.Scale):
675 master: tkinter.Misc | None = ...,
678 command: str | Callable[[str], Any] = ...,
679 cursor: tkinter._Cursor = ...,
681 length: tkinter._ScreenUnits = ...,
683 orient: Literal["horizontal", "vertical"] = ...,
684 state: str = ..., # undocumented
686 takefocus: tkinter._TakeFocusValue = ...,
689 variable: tkinter.IntVar | tkinter.DoubleVar = ...,
691 @overload # type: ignore
694 cnf: dict[str, Any] | None = ...,
696 command: str | Callable[[str], Any] = ...,
697 cursor: tkinter._Cursor = ...,
699 length: tkinter._ScreenUnits = ...,
700 orient: Literal["horizontal", "vertical"] = ...,
703 takefocus: tkinter._TakeFocusValue = ...,
706 variable: tkinter.IntVar | tkinter.DoubleVar = ...,
707 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
709 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
710 # config must be copy/pasted, otherwise ttk.Scale().config is mypy error (don't know why)
711 @overload # type: ignore
714 cnf: dict[str, Any] | None = ...,
716 command: str | Callable[[str], Any] = ...,
717 cursor: tkinter._Cursor = ...,
719 length: tkinter._ScreenUnits = ...,
720 orient: Literal["horizontal", "vertical"] = ...,
723 takefocus: tkinter._TakeFocusValue = ...,
726 variable: tkinter.IntVar | tkinter.DoubleVar = ...,
727 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
729 def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
730 def get(self, x: Any | None = ..., y: Any | None = ...): ...
732 class Scrollbar(Widget, tkinter.Scrollbar):
735 master: tkinter.Misc | None = ...,
738 command: Callable[..., tuple[float, float] | None] | str = ...,
739 cursor: tkinter._Cursor = ...,
741 orient: Literal["horizontal", "vertical"] = ...,
743 takefocus: tkinter._TakeFocusValue = ...,
745 @overload # type: ignore
748 cnf: dict[str, Any] | None = ...,
750 command: Callable[..., tuple[float, float] | None] | str = ...,
751 cursor: tkinter._Cursor = ...,
752 orient: Literal["horizontal", "vertical"] = ...,
754 takefocus: tkinter._TakeFocusValue = ...,
755 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
757 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
758 # config must be copy/pasted, otherwise ttk.Scrollbar().config is mypy error (don't know why)
759 @overload # type: ignore
762 cnf: dict[str, Any] | None = ...,
764 command: Callable[..., tuple[float, float] | None] | str = ...,
765 cursor: tkinter._Cursor = ...,
766 orient: Literal["horizontal", "vertical"] = ...,
768 takefocus: tkinter._TakeFocusValue = ...,
769 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
771 def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
773 class Separator(Widget):
776 master: tkinter.Misc | None = ...,
779 cursor: tkinter._Cursor = ...,
781 orient: Literal["horizontal", "vertical"] = ...,
783 takefocus: tkinter._TakeFocusValue = ...,
788 cnf: dict[str, Any] | None = ...,
790 cursor: tkinter._Cursor = ...,
791 orient: Literal["horizontal", "vertical"] = ...,
793 takefocus: tkinter._TakeFocusValue = ...,
794 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
796 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
799 class Sizegrip(Widget):
802 master: tkinter.Misc | None = ...,
805 cursor: tkinter._Cursor = ...,
808 takefocus: tkinter._TakeFocusValue = ...,
813 cnf: dict[str, Any] | None = ...,
815 cursor: tkinter._Cursor = ...,
817 takefocus: tkinter._TakeFocusValue = ...,
818 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
820 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
823 if sys.version_info >= (3, 7):
824 class Spinbox(Entry):
827 master: tkinter.Misc | None = ...,
829 background: tkinter._Color = ..., # undocumented
831 command: Callable[[], Any] | str | list[str] | Tuple[str, ...] = ...,
832 cursor: tkinter._Cursor = ...,
833 exportselection: bool = ..., # undocumented
834 font: _FontDescription = ..., # undocumented
835 foreground: tkinter._Color = ..., # undocumented
838 increment: float = ...,
839 invalidcommand: tkinter._EntryValidateCommand = ..., # undocumented
840 justify: Literal["left", "center", "right"] = ..., # undocumented
842 show: Any = ..., # undocumented
845 takefocus: tkinter._TakeFocusValue = ...,
846 textvariable: tkinter.Variable = ..., # undocumented
848 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
849 validatecommand: tkinter._EntryValidateCommand = ...,
850 values: list[str] | Tuple[str, ...] = ...,
851 width: int = ..., # undocumented
853 xscrollcommand: tkinter._XYScrollCommand = ...,
855 @overload # type: ignore
858 cnf: dict[str, Any] | None = ...,
860 background: tkinter._Color = ...,
861 command: Callable[[], Any] | str | list[str] | Tuple[str, ...] = ...,
862 cursor: tkinter._Cursor = ...,
863 exportselection: bool = ...,
864 font: _FontDescription = ...,
865 foreground: tkinter._Color = ...,
868 increment: float = ...,
869 invalidcommand: tkinter._EntryValidateCommand = ...,
870 justify: Literal["left", "center", "right"] = ...,
874 takefocus: tkinter._TakeFocusValue = ...,
875 textvariable: tkinter.Variable = ...,
877 validate: Literal["none", "focus", "focusin", "focusout", "key", "all"] = ...,
878 validatecommand: tkinter._EntryValidateCommand = ...,
879 values: list[str] | Tuple[str, ...] = ...,
882 xscrollcommand: tkinter._XYScrollCommand = ...,
883 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
885 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
886 config = configure # type: ignore
887 def set(self, value: Any) -> None: ...
889 class _TreeviewItemDict(TypedDict):
891 image: list[str] | Literal[""] # no idea why it's wrapped in list
892 values: list[Any] | Literal[""]
893 open: bool # actually 0 or 1
894 tags: list[str] | Literal[""]
896 class _TreeviewTagDict(TypedDict):
897 # There is also 'text' and 'anchor', but they don't seem to do anything, using them is likely a bug
898 foreground: tkinter._Color
899 background: tkinter._Color
900 font: _FontDescription
901 image: Literal[""] | str # not wrapped in list :D
903 class _TreeviewHeaderDict(TypedDict):
906 anchor: tkinter._Anchor
908 state: str # Doesn't seem to appear anywhere else than in these dicts
910 class _TreeviewColumnDict(TypedDict):
913 stretch: bool # actually 0 or 1
914 anchor: tkinter._Anchor
917 _TreeviewColumnId = Union[int, str] # manual page: "COLUMN IDENTIFIERS"
919 class Treeview(Widget, tkinter.XView, tkinter.YView):
922 master: tkinter.Misc | None = ...,
925 columns: str | list[str] | Tuple[str, ...] = ...,
926 cursor: tkinter._Cursor = ...,
927 displaycolumns: str | list[str] | Tuple[str, ...] | list[int] | Tuple[int, ...] | Literal["#all"] = ...,
930 padding: tkinter._Padding = ...,
931 selectmode: Literal["extended", "browse", "none"] = ...,
932 # list/tuple of Literal don't actually work in mypy
934 # 'tree headings' is same as ['tree', 'headings'], and I wouldn't be
935 # surprised if someone is using it.
936 show: Literal["tree", "headings", "tree headings", ""] | list[str] | Tuple[str, ...] = ...,
938 takefocus: tkinter._TakeFocusValue = ...,
939 xscrollcommand: tkinter._XYScrollCommand = ...,
940 yscrollcommand: tkinter._XYScrollCommand = ...,
945 cnf: dict[str, Any] | None = ...,
947 columns: str | list[str] | Tuple[str, ...] = ...,
948 cursor: tkinter._Cursor = ...,
949 displaycolumns: str | list[str] | Tuple[str, ...] | list[int] | Tuple[int, ...] | Literal["#all"] = ...,
951 padding: tkinter._Padding = ...,
952 selectmode: Literal["extended", "browse", "none"] = ...,
953 show: Literal["tree", "headings", "tree headings", ""] | list[str] | Tuple[str, ...] = ...,
955 takefocus: tkinter._TakeFocusValue = ...,
956 xscrollcommand: tkinter._XYScrollCommand = ...,
957 yscrollcommand: tkinter._XYScrollCommand = ...,
958 ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ...
960 def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
962 def bbox(self, item, column: _TreeviewColumnId | None = ...) -> tuple[int, int, int, int] | Literal[""]: ... # type: ignore
963 def get_children(self, item: str | None = ...) -> Tuple[str, ...]: ...
964 def set_children(self, item: str, *newchildren: str) -> None: ...
966 def column(self, column: _TreeviewColumnId, option: Literal["width", "minwidth"]) -> int: ...
968 def column(self, column: _TreeviewColumnId, option: Literal["stretch"]) -> bool: ... # actually 0 or 1
970 def column(self, column: _TreeviewColumnId, option: Literal["anchor"]) -> _tkinter.Tcl_Obj: ...
972 def column(self, column: _TreeviewColumnId, option: Literal["id"]) -> str: ...
974 def column(self, column: _TreeviewColumnId, option: str) -> Any: ...
978 column: _TreeviewColumnId,
984 anchor: tkinter._Anchor = ...,
986 ) -> _TreeviewColumnDict | None: ...
987 def delete(self, *items: str) -> None: ...
988 def detach(self, *items: str) -> None: ...
989 def exists(self, item: str) -> bool: ...
990 @overload # type: ignore
991 def focus(self, item: None = ...) -> str: ... # can return empty string
993 def focus(self, item: str) -> Literal[""]: ...
995 def heading(self, column: _TreeviewColumnId, option: Literal["text"]) -> str: ...
997 def heading(self, column: _TreeviewColumnId, option: Literal["image"]) -> tuple[str]: ...
999 def heading(self, column: _TreeviewColumnId, option: Literal["anchor"]) -> _tkinter.Tcl_Obj: ...
1001 def heading(self, column: _TreeviewColumnId, option: Literal["command"]) -> str: ...
1003 def heading(self, column: _TreeviewColumnId, option: str) -> Any: ...
1007 column: _TreeviewColumnId,
1011 image: tkinter._ImageSpec = ...,
1012 anchor: tkinter._Anchor = ...,
1013 command: str | Callable[[], Any] = ...,
1014 ) -> _TreeviewHeaderDict | None: ...
1015 def identify(self, component, x, y): ...
1016 def identify_row(self, y: int) -> str: ...
1017 def identify_column(self, x: int) -> str: ...
1018 def identify_region(self, x: int, y: int) -> Literal["heading", "separator", "tree", "cell", "nothing"]: ...
1019 def identify_element(self, x: int, y: int) -> str: ... # don't know what possible return values are
1020 def index(self, item: str) -> int: ...
1024 index: int | Literal["end"],
1025 iid: str | None = ...,
1027 id: str = ..., # same as iid
1029 image: tkinter._ImageSpec = ...,
1030 values: list[Any] | Tuple[Any, ...] = ...,
1032 tags: str | list[str] | Tuple[str, ...] = ...,
1035 def item(self, item: str, option: Literal["text"]) -> str: ...
1037 def item(self, item: str, option: Literal["image"]) -> tuple[str] | Literal[""]: ...
1039 def item(self, item: str, option: Literal["values"]) -> Tuple[Any, ...] | Literal[""]: ...
1041 def item(self, item: str, option: Literal["open"]) -> bool: ... # actually 0 or 1
1043 def item(self, item: str, option: Literal["tags"]) -> Tuple[str, ...] | Literal[""]: ...
1045 def item(self, item: str, option: str) -> Any: ...
1053 image: tkinter._ImageSpec = ...,
1054 values: list[Any] | Tuple[Any, ...] | Literal[""] = ...,
1056 tags: str | list[str] | Tuple[str, ...] = ...,
1057 ) -> _TreeviewItemDict | None: ...
1058 def move(self, item: str, parent: str, index: int) -> None: ...
1060 def next(self, item: str) -> str: ... # returning empty string means last item
1061 def parent(self, item: str) -> str: ...
1062 def prev(self, item: str) -> str: ... # returning empty string means first item
1063 def see(self, item: str) -> None: ...
1064 if sys.version_info >= (3, 8):
1065 def selection(self) -> Tuple[str, ...]: ...
1067 def selection(self, selop: Any | None = ..., items: Any | None = ...) -> Tuple[str, ...]: ...
1068 def selection_set(self, items: str | list[str] | Tuple[str, ...]) -> None: ...
1069 def selection_add(self, items: str | list[str] | Tuple[str, ...]) -> None: ...
1070 def selection_remove(self, items: str | list[str] | Tuple[str, ...]) -> None: ...
1071 def selection_toggle(self, items: str | list[str] | Tuple[str, ...]) -> None: ...
1073 def set(self, item: str, column: None = ..., value: None = ...) -> dict[str, Any]: ...
1075 def set(self, item: str, column: _TreeviewColumnId, value: None = ...) -> Any: ...
1077 def set(self, item: str, column: _TreeviewColumnId, value: Any) -> Literal[""]: ...
1078 # There's no tag_unbind() or 'add' argument for whatever reason.
1079 # Also, it's 'callback' instead of 'func' here.
1082 self, tagname: str, sequence: str | None = ..., callback: Callable[[tkinter.Event[Treeview]], Any] | None = ...
1085 def tag_bind(self, tagname: str, sequence: str | None, callback: str) -> None: ...
1087 def tag_bind(self, tagname: str, *, callback: str) -> None: ...
1089 def tag_configure(self, tagname: str, option: Literal["foreground", "background"]) -> tkinter._Color: ...
1091 def tag_configure(self, tagname: str, option: Literal["font"]) -> _FontDescription: ...
1093 def tag_configure(self, tagname: str, option: Literal["image"]) -> str: ...
1100 # There is also 'text' and 'anchor', but they don't seem to do anything, using them is likely a bug
1101 foreground: tkinter._Color = ...,
1102 background: tkinter._Color = ...,
1103 font: _FontDescription = ...,
1104 image: tkinter._ImageSpec = ...,
1105 ) -> _TreeviewTagDict | Any: ... # can be None but annoying to check
1107 def tag_has(self, tagname: str, item: None = ...) -> Tuple[str, ...]: ...
1109 def tag_has(self, tagname: str, item: str) -> bool: ...
1111 class LabeledScale(Frame):
1114 # TODO: don't any-type **kw. That goes to Frame.__init__.
1117 master: tkinter.Misc | None = ...,
1118 variable: tkinter.IntVar | tkinter.DoubleVar | None = ...,
1122 compound: Literal["top"] | Literal["bottom"] = ...,
1125 # destroy is overridden, signature does not change
1128 class OptionMenu(Menubutton):
1133 default: str | None = ...,
1135 # rest of these are keyword-only because *args syntax used above
1137 direction: Literal["above"] | Literal["below"] | Literal["left"] | Literal["right"] | Literal["flush"] = ...,
1138 command: Callable[[tkinter.StringVar], Any] | None = ...,
1140 # configure, config, cget, destroy are inherited from Menubutton
1141 # destroy and __setitem__ are overridden, signature does not change
1142 def set_menu(self, default: Any | None = ..., *values): ...