2 from typing_extensions import Literal, final
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.
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:
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'>)
19 string: str # str(tclobj) returns this
22 class TclError(Exception): ...
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:
27 # >>> import tkinter, _tkinter
28 # >>> tkapp = tkinter.Tk().tk
29 # >>> isinstance(tkapp, _tkinter.TkappType)
31 # >>> tkapp.call('set', 'foo', (1,2,3))
33 # >>> tkapp.eval('return $foo')
37 # call args can be pretty much anything. Also, call(some_tuple) is same as call(*some_tuple).
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.
43 # Please keep in sync with tkinter.Tk
44 def call(self, __command: Any, *args: Any) -> Any: ...
45 def eval(self, __script: str) -> str: ...
48 createfilehandler: Any
49 createtimerhandler: Any
51 deletefilehandler: Any
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]
92 # TODO: figure out what these are (with e.g. help()) and get rid of Any
96 getbusywaitinterval: Any
97 setbusywaitinterval: Any