MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / after

Method after

tools/python-3.11.9-amd64/Lib/tkinter/__init__.py:847–873  ·  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

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

Callers 15

after_idleMethod · 0.95
_delayMethod · 0.80
_ontimerMethod · 0.80
test_afterMethod · 0.80
test_after_cancelMethod · 0.80
callbackMethod · 0.80
test_mainloopMethod · 0.80
poll_subprocessMethod · 0.80
hide_eventMethod · 0.80
timer_eventMethod · 0.80
runMethod · 0.80

Calls 3

_registerMethod · 0.95
callMethod · 0.80
typeClass · 0.50

Tested by 7

test_afterMethod · 0.64
test_after_cancelMethod · 0.64
callbackMethod · 0.64
test_mainloopMethod · 0.64
after_callbackFunction · 0.64
new_test_methodFunction · 0.64
test_del_with_timerMethod · 0.64