massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / _tkinter.pyi
1 from typing import Any
2 from typing_extensions import Literal, final
3
4 # _tkinter is meant to be only used internally by tkinter, but some tkinter
5 # functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl
6 # object that hasn't been converted to a string.
7 #
8 # There are not many ways to get Tcl_Objs from tkinter, and I'm not sure if the
9 # only existing ways are supposed to return Tcl_Objs as opposed to returning
10 # strings. Here's one of these things that return Tcl_Objs:
11 #
12 #    >>> import tkinter
13 #    >>> text = tkinter.Text()
14 #    >>> text.tag_add('foo', '1.0', 'end')
15 #    >>> text.tag_ranges('foo')
16 #    (<textindex object: '1.0'>, <textindex object: '2.0'>)
17 @final
18 class Tcl_Obj:
19     string: str  # str(tclobj) returns this
20     typename: str
21
22 class TclError(Exception): ...
23
24 # This class allows running Tcl code. Tkinter uses it internally a lot, and
25 # it's often handy to drop a piece of Tcl code into a tkinter program. Example:
26 #
27 #    >>> import tkinter, _tkinter
28 #    >>> tkapp = tkinter.Tk().tk
29 #    >>> isinstance(tkapp, _tkinter.TkappType)
30 #    True
31 #    >>> tkapp.call('set', 'foo', (1,2,3))
32 #    (1, 2, 3)
33 #    >>> tkapp.eval('return $foo')
34 #    '1 2 3'
35 #    >>>
36 #
37 # call args can be pretty much anything. Also, call(some_tuple) is same as call(*some_tuple).
38 #
39 # eval always returns str because _tkinter_tkapp_eval_impl in _tkinter.c calls
40 # Tkapp_UnicodeResult, and it returns a string when it succeeds.
41 @final
42 class TkappType:
43     # Please keep in sync with tkinter.Tk
44     def call(self, __command: Any, *args: Any) -> Any: ...
45     def eval(self, __script: str) -> str: ...
46     adderrorinfo: Any
47     createcommand: Any
48     createfilehandler: Any
49     createtimerhandler: Any
50     deletecommand: Any
51     deletefilehandler: Any
52     dooneevent: Any
53     evalfile: Any
54     exprboolean: Any
55     exprdouble: Any
56     exprlong: Any
57     exprstring: Any
58     getboolean: Any
59     getdouble: Any
60     getint: Any
61     getvar: Any
62     globalgetvar: Any
63     globalsetvar: Any
64     globalunsetvar: Any
65     interpaddr: Any
66     loadtk: Any
67     mainloop: Any
68     quit: Any
69     record: Any
70     setvar: Any
71     split: Any
72     splitlist: Any
73     unsetvar: Any
74     wantobjects: Any
75     willdispatch: Any
76
77 # These should be kept in sync with tkinter.tix constants, except ALL_EVENTS which doesn't match TCL_ALL_EVENTS
78 ALL_EVENTS: Literal[-3]
79 FILE_EVENTS: Literal[8]
80 IDLE_EVENTS: Literal[32]
81 TIMER_EVENTS: Literal[16]
82 WINDOW_EVENTS: Literal[4]
83
84 DONT_WAIT: Literal[2]
85 EXCEPTION: Literal[8]
86 READABLE: Literal[2]
87 WRITABLE: Literal[4]
88
89 TCL_VERSION: str
90 TK_VERSION: str
91
92 # TODO: figure out what these are (with e.g. help()) and get rid of Any
93 TkttType: Any
94 _flatten: Any
95 create: Any
96 getbusywaitinterval: Any
97 setbusywaitinterval: Any