Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FF: CountdownTimer init use reset instead of add for initial time #5609

Merged
merged 1 commit into from Jun 21, 2023

Conversation

gtosh4
Copy link
Contributor

@gtosh4 gtosh4 commented Jun 1, 2023

Following the example & documentation,

timer = core.CountdownTimer(5)

would cause the warning to show

WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['sounddevice', 'PTB', 'pyo', 'pygame'] (in that order).

How I found it (if that's at all useful) is to replace the Clock.add function to raise an exception to get the traceback.

def newAdd(self, x):
    raise Exception("Clock.add is deprecated")

core.Clock.add = newAdd

which resulted in the traceback:

  File "XXX\experiment1.py", line 330, in testF
    timer = core.CountdownTimer(2)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\clock.py", line 226, in __init__
    self.add(start)
  File "XXX\experiment1.py", line 30, in newAdd
    raise Exception("Clock.add is deprecated")

While I was there, I also simplified the CountdownTimer.reset() function a little.

@gtosh4 gtosh4 changed the title CountdownTimer init use reset instead of add for initial time FF: CountdownTimer init use reset instead of add for initial time Jun 1, 2023
@gtosh4 gtosh4 force-pushed the bugfix/countdowntimer_warning branch from 8e10900 to a14454e Compare June 1, 2023 22:37
@peircej peircej merged commit e73b8d8 into psychopy:dev Jun 21, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants