@@ -81,7 +81,8 @@ def tick(self, delta_time):
81
81
if e ._deadline > cur_time :
82
82
tba_append (e )
83
83
continue
84
- if e .callback (cur_time - e ._last_tick ) is False or e ._interval is None :
84
+ e .callback (cur_time - e ._last_tick )
85
+ if e ._interval is None :
85
86
continue
86
87
e ._deadline += e ._interval
87
88
e ._last_tick = cur_time
@@ -118,21 +119,6 @@ def schedule_once(self, func, delay) -> ClockEvent:
118
119
def schedule_interval (self , func , interval ) -> ClockEvent :
119
120
'''
120
121
Schedules the ``func`` to be called repeatedly at a specified interval.
121
-
122
- There are two ways to unschedule the event. One is the same as :meth:`schedule_once`.
123
-
124
- .. code-block::
125
-
126
- with clock.schedule_interval(func, 10):
127
- ...
128
-
129
- The other one is to return ``False`` from the callback function.
130
-
131
- .. code-block::
132
-
133
- def func(dt):
134
- if some_condition:
135
- return False
136
122
'''
137
123
cur_time = self ._cur_time
138
124
event = ClockEvent (cur_time + interval , cur_time , func , interval )
@@ -195,7 +181,6 @@ def callback(dt):
195
181
n -= 1
196
182
if not n :
197
183
task ._step ()
198
- return False
199
184
200
185
event = self .schedule_interval (callback , 0 )
201
186
@@ -222,9 +207,9 @@ async def anim_with_dt(self, *, step=0) -> AsyncIterator[TimeUnit]:
222
207
def callback(dt):
223
208
print(dt)
224
209
if some_condition:
225
- return False
210
+ event.cancel()
226
211
227
- clock.schedule_interval(callback, 10)
212
+ event = clock.schedule_interval(callback, 10)
228
213
229
214
**Restriction**
230
215
@@ -479,7 +464,6 @@ def _update(setattr, zip, min, obj, duration, transition, output_seq_type, anim_
479
464
# time to stop ?
480
465
if progress >= 1. :
481
466
task ._step ()
482
- return False
483
467
484
468
_update = partial (_update , setattr , zip , min )
485
469
0 commit comments