MCPcopy Index your code
hub / github.com/RustPython/RustPython / after

Method after

Lib/tkinter/__init__.py:848–874  ·  view source on GitHub ↗

Call function once after given time. MS specifies the time in milliseconds. FUNC gives the function which shall be called. Additional parameters are given as parameters to the function call. Return identifier to cancel scheduling with after_cancel.

(self, ms, func=None, *args)

Source from the content-addressed store, hash-verified

846 return self._nametowidget(name)
847
848 def after(self, ms, func=None, *args):
849 """Call function once after given time.
850
851 MS specifies the time in milliseconds. FUNC gives the
852 function which shall be called. Additional parameters
853 are given as parameters to the function call. Return
854 identifier to cancel scheduling with after_cancel."""
855 if func is None:
856 # I'd rather use time.sleep(ms*0.001)
857 self.tk.call('after', ms)
858 return None
859 else:
860 def callit():
861 try:
862 func(*args)
863 finally:
864 try:
865 self.deletecommand(name)
866 except TclError:
867 pass
868 try:
869 callit.__name__ = func.__name__
870 except AttributeError:
871 # Required for callable classes (bpo-44404)
872 callit.__name__ = type(func).__name__
873 name = self._register(callit)
874 return self.tk.call('after', ms, name)
875
876 def after_idle(self, func, *args):
877 """Call FUNC once if the Tcl main loop has no event to

Callers 1

after_idleMethod · 0.95

Calls 2

_registerMethod · 0.95
callMethod · 0.45

Tested by

no test coverage detected