mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-03-12 18:06:45 +08:00
Improve _tkinter (#6908)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
"stdlib/distutils/command",
|
||||
"stdlib/lib2to3/refactor.pyi",
|
||||
"stdlib/sqlite3/dbapi2.pyi",
|
||||
"stdlib/_tkinter.pyi",
|
||||
"stdlib/tkinter",
|
||||
"stdlib/unittest/mock.pyi",
|
||||
"stdlib/xml/dom/NodeFilter.pyi",
|
||||
|
||||
@@ -17,8 +17,15 @@ from typing_extensions import Literal, final
|
||||
# (<textindex object: '1.0'>, <textindex object: '2.0'>)
|
||||
@final
|
||||
class Tcl_Obj:
|
||||
string: str # str(tclobj) returns this
|
||||
string: str | bytes
|
||||
typename: str
|
||||
__hash__: None # type: ignore[assignment]
|
||||
def __eq__(self, other): ...
|
||||
def __ge__(self, other): ...
|
||||
def __gt__(self, other): ...
|
||||
def __le__(self, other): ...
|
||||
def __lt__(self, other): ...
|
||||
def __ne__(self, other): ...
|
||||
|
||||
class TclError(Exception): ...
|
||||
|
||||
@@ -42,39 +49,40 @@ class TclError(Exception): ...
|
||||
@final
|
||||
class TkappType:
|
||||
# Please keep in sync with tkinter.Tk
|
||||
def adderrorinfo(self, __msg): ...
|
||||
def call(self, __command: Any, *args: Any) -> Any: ...
|
||||
def createcommand(self, __name, __func): ...
|
||||
if sys.platform != "win32":
|
||||
def createfilehandler(self, __file, __mask, __func): ...
|
||||
def deletefilehandler(self, __file): ...
|
||||
def createtimerhandler(self, __milliseconds, __func): ...
|
||||
def deletecommand(self, __name): ...
|
||||
def dooneevent(self, __flags: int = ...): ...
|
||||
def eval(self, __script: str) -> str: ...
|
||||
adderrorinfo: Any
|
||||
createcommand: Any
|
||||
createfilehandler: Any
|
||||
createtimerhandler: Any
|
||||
deletecommand: Any
|
||||
deletefilehandler: Any
|
||||
dooneevent: Any
|
||||
evalfile: Any
|
||||
exprboolean: Any
|
||||
exprdouble: Any
|
||||
exprlong: Any
|
||||
exprstring: Any
|
||||
getboolean: Any
|
||||
getdouble: Any
|
||||
getint: Any
|
||||
getvar: Any
|
||||
globalgetvar: Any
|
||||
globalsetvar: Any
|
||||
globalunsetvar: Any
|
||||
interpaddr: Any
|
||||
loadtk: Any
|
||||
mainloop: Any
|
||||
quit: Any
|
||||
record: Any
|
||||
setvar: Any
|
||||
def evalfile(self, __fileName): ...
|
||||
def exprboolean(self, __s): ...
|
||||
def exprdouble(self, __s): ...
|
||||
def exprlong(self, __s): ...
|
||||
def exprstring(self, __s): ...
|
||||
def getboolean(self, __arg): ...
|
||||
def getdouble(self, __arg): ...
|
||||
def getint(self, __arg): ...
|
||||
def getvar(self, *args, **kwargs): ...
|
||||
def globalgetvar(self, *args, **kwargs): ...
|
||||
def globalsetvar(self, *args, **kwargs): ...
|
||||
def globalunsetvar(self, *args, **kwargs): ...
|
||||
def interpaddr(self): ...
|
||||
def loadtk(self) -> None: ...
|
||||
def mainloop(self, __threshold: int = ...): ...
|
||||
def quit(self): ...
|
||||
def record(self, __script): ...
|
||||
def setvar(self, *ags, **kwargs): ...
|
||||
if sys.version_info < (3, 11):
|
||||
split: Any
|
||||
splitlist: Any
|
||||
unsetvar: Any
|
||||
wantobjects: Any
|
||||
willdispatch: Any
|
||||
def split(self, __arg): ...
|
||||
def splitlist(self, __arg): ...
|
||||
def unsetvar(self, *args, **kwargs): ...
|
||||
def wantobjects(self, *args, **kwargs): ...
|
||||
def willdispatch(self): ...
|
||||
|
||||
# These should be kept in sync with tkinter.tix constants, except ALL_EVENTS which doesn't match TCL_ALL_EVENTS
|
||||
ALL_EVENTS: Literal[-3]
|
||||
@@ -91,9 +99,18 @@ WRITABLE: Literal[4]
|
||||
TCL_VERSION: str
|
||||
TK_VERSION: str
|
||||
|
||||
# TODO: figure out what these are (with e.g. help()) and get rid of Any
|
||||
TkttType: Any
|
||||
_flatten: Any
|
||||
create: Any
|
||||
getbusywaitinterval: Any
|
||||
setbusywaitinterval: Any
|
||||
class TkttType:
|
||||
def deletetimerhandler(self): ...
|
||||
|
||||
def create(
|
||||
__screenName: str | None = ...,
|
||||
__baseName: str | None = ...,
|
||||
__className: str = ...,
|
||||
__interactive: bool = ...,
|
||||
__wantobjects: bool = ...,
|
||||
__wantTk: bool = ...,
|
||||
__sync: bool = ...,
|
||||
__use: str | None = ...,
|
||||
): ...
|
||||
def getbusywaitinterval(): ...
|
||||
def setbusywaitinterval(__new_val): ...
|
||||
|
||||
@@ -610,44 +610,38 @@ class Tk(Misc, Wm):
|
||||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def loadtk(self) -> None: ... # differs from _tkinter.TkappType.loadtk
|
||||
def destroy(self) -> None: ...
|
||||
def readprofile(self, baseName: str, className: str) -> None: ...
|
||||
report_callback_exception: _ExceptionReportingCallback
|
||||
# Tk has __getattr__ so that tk_instance.foo falls back to tk_instance.tk.foo
|
||||
# Please keep in sync with _tkinter.TkappType
|
||||
call: Callable[..., Any]
|
||||
def eval(self, __code: str) -> str: ...
|
||||
adderrorinfo: Any
|
||||
createcommand: Any
|
||||
createfilehandler: Any
|
||||
createtimerhandler: Any
|
||||
deletecommand: Any
|
||||
deletefilehandler: Any
|
||||
dooneevent: Any
|
||||
evalfile: Any
|
||||
exprboolean: Any
|
||||
exprdouble: Any
|
||||
exprlong: Any
|
||||
exprstring: Any
|
||||
getboolean: Any
|
||||
getdouble: Any
|
||||
getint: Any
|
||||
getvar: Any
|
||||
globalgetvar: Any
|
||||
globalsetvar: Any
|
||||
globalunsetvar: Any
|
||||
interpaddr: Any
|
||||
mainloop: Any
|
||||
quit: Any
|
||||
record: Any
|
||||
setvar: Any
|
||||
# Please keep in sync with _tkinter.TkappType.
|
||||
# Some methods are intentionally missing because they are inherited from Misc instead.
|
||||
def adderrorinfo(self, __msg): ...
|
||||
def call(self, __command: Any, *args: Any) -> Any: ...
|
||||
def createcommand(self, __name, __func): ...
|
||||
if sys.platform != "win32":
|
||||
def createfilehandler(self, __file, __mask, __func): ...
|
||||
def deletefilehandler(self, __file): ...
|
||||
def createtimerhandler(self, __milliseconds, __func): ...
|
||||
def dooneevent(self, __flags: int = ...): ...
|
||||
def eval(self, __script: str) -> str: ...
|
||||
def evalfile(self, __fileName): ...
|
||||
def exprboolean(self, __s): ...
|
||||
def exprdouble(self, __s): ...
|
||||
def exprlong(self, __s): ...
|
||||
def exprstring(self, __s): ...
|
||||
def globalgetvar(self, *args, **kwargs): ...
|
||||
def globalsetvar(self, *args, **kwargs): ...
|
||||
def globalunsetvar(self, *args, **kwargs): ...
|
||||
def interpaddr(self): ...
|
||||
def loadtk(self) -> None: ...
|
||||
def record(self, __script): ...
|
||||
if sys.version_info < (3, 11):
|
||||
split: Any
|
||||
splitlist: Any
|
||||
unsetvar: Any
|
||||
wantobjects: Any
|
||||
willdispatch: Any
|
||||
def split(self, __arg): ...
|
||||
def splitlist(self, __arg): ...
|
||||
def unsetvar(self, *args, **kwargs): ...
|
||||
def wantobjects(self, *args, **kwargs): ...
|
||||
def willdispatch(self): ...
|
||||
|
||||
def Tcl(screenName: Any | None = ..., baseName: Any | None = ..., className: str = ..., useTk: bool = ...): ...
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ stat.FILE_ATTRIBUTE_[A-Z_]+
|
||||
(sqlite3(.dbapi2)?.Connection.enable_load_extension)?
|
||||
(sqlite3(.dbapi2)?.Connection.load_extension)?
|
||||
|
||||
# Methods that come from __getattr__() at runtime
|
||||
tkinter.Tk.createfilehandler
|
||||
tkinter.Tk.deletefilehandler
|
||||
|
||||
# Exists at runtime, but missing from stubs
|
||||
distutils.msvccompiler.MSVCCompiler.get_msvc_paths
|
||||
distutils.msvccompiler.MSVCCompiler.set_path_env_var
|
||||
|
||||
@@ -47,6 +47,10 @@ stat.FILE_ATTRIBUTE_[A-Z_]+
|
||||
(sqlite3(.dbapi2)?.Connection.enable_load_extension)?
|
||||
(sqlite3(.dbapi2)?.Connection.load_extension)?
|
||||
|
||||
# Methods that come from __getattr__() at runtime
|
||||
tkinter.Tk.createfilehandler
|
||||
tkinter.Tk.deletefilehandler
|
||||
|
||||
# Exists at runtime, but missing from stubs
|
||||
distutils.msvccompiler.MSVCCompiler.get_msvc_paths
|
||||
distutils.msvccompiler.MSVCCompiler.set_path_env_var
|
||||
|
||||
@@ -370,6 +370,28 @@ tkinter.Place.forget
|
||||
tkinter.Place.place_slaves
|
||||
tkinter.Place.slaves
|
||||
|
||||
# Methods that come from __getattr__() at runtime
|
||||
tkinter.Tk.adderrorinfo
|
||||
tkinter.Tk.call
|
||||
tkinter.Tk.createcommand
|
||||
tkinter.Tk.createtimerhandler
|
||||
tkinter.Tk.dooneevent
|
||||
tkinter.Tk.evalfile
|
||||
tkinter.Tk.exprboolean
|
||||
tkinter.Tk.exprdouble
|
||||
tkinter.Tk.exprlong
|
||||
tkinter.Tk.exprstring
|
||||
tkinter.Tk.globalgetvar
|
||||
tkinter.Tk.globalsetvar
|
||||
tkinter.Tk.globalunsetvar
|
||||
tkinter.Tk.interpaddr
|
||||
tkinter.Tk.record
|
||||
tkinter.Tk.split
|
||||
tkinter.Tk.splitlist
|
||||
tkinter.Tk.unsetvar
|
||||
tkinter.Tk.wantobjects
|
||||
tkinter.Tk.willdispatch
|
||||
|
||||
# Undocumented and have a comment in the source code saying "State variables (don't mess with these)"
|
||||
wsgiref.handlers.BaseHandler.bytes_sent
|
||||
wsgiref.handlers.BaseHandler.headers
|
||||
|
||||
Reference in New Issue
Block a user