Arrange for a callback to be called at a given time. Return a Handle: an opaque object with a cancel() method that can be used to cancel the call. The delay can be an int or float, expressed in seconds. It is always relative to the current time. Each callb
(self, delay, callback, *args, context=None)
| 778 | return time.monotonic() |
| 779 | |
| 780 | def call_later(self, delay, callback, *args, context=None): |
| 781 | """Arrange for a callback to be called at a given time. |
| 782 | |
| 783 | Return a Handle: an opaque object with a cancel() method that |
| 784 | can be used to cancel the call. |
| 785 | |
| 786 | The delay can be an int or float, expressed in seconds. It is |
| 787 | always relative to the current time. |
| 788 | |
| 789 | Each callback will be called exactly once. If two callbacks |
| 790 | are scheduled for exactly the same time, it is undefined which |
| 791 | will be called first. |
| 792 | |
| 793 | Any positional arguments after the callback will be passed to |
| 794 | the callback when it is called. |
| 795 | """ |
| 796 | if delay is None: |
| 797 | raise TypeError('delay must not be None') |
| 798 | timer = self.call_at(self.time() + delay, callback, *args, |
| 799 | context=context) |
| 800 | if timer._source_traceback: |
| 801 | del timer._source_traceback[-1] |
| 802 | return timer |
| 803 | |
| 804 | def call_at(self, when, callback, *args, context=None): |
| 805 | """Like call_later(), but uses an absolute time. |