Skip to content

Commit

Permalink
Merge pull request psychopy#6814 from zeyus/master
Browse files Browse the repository at this point in the history
ENH: allow recursive callOnFlip() calls
  • Loading branch information
peircej authored Sep 16, 2024
2 parents ad1a0ea + e12db30 commit 6ea8121
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions psychopy/visual/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,12 @@ def flip(self, clearBuffer=True):
self._frameTime = now = logging.defaultClock.getTime()
self._frameTimes.append(self._frameTime)

# run other functions immediately after flip completes
for callEntry in self._toCall:
callEntry['function'](*callEntry['args'], **callEntry['kwargs'])
del self._toCall[:]
# run scheduled functions immediately after flip completes
n_items = len(self._toCall)
for i in range(n_items):
self._toCall[i]['function'](*self._toCall[i]['args'], **self._toCall[i]['kwargs'])
# leave newly scheduled functions for next flip
del self._toCall[:n_items]

# do bookkeeping
if self.recordFrameIntervals:
Expand Down

0 comments on commit 6ea8121

Please sign in to comment.