Cannot do a "waitKey" after playing a video with "MovieStim3"

Hello,
I have some problems with MovieStim3.
I am trying to play a movie and when it finishes, the code waits for a keypress (“T” or “V”).
However, after the movie is played, I have to click with my pad on the window (which is already in fullscreen) to get the keyboard event.
I am working with Psychopy v2020.1.3 on Windows 10.

Find bellow the code

from psychopy import visual, core, event
from psychopy.event import getKeys, waitKeys

win = visual.Window((1024, 768), fullscr = True)
mov = visual.MovieStim3(win, "video/videoTest.mp4", size=(320, 240))

while mov.status != visual.FINISHED:
    mov.draw()
    win.flip()
    if event.getKeys():
        break
waitKeys(keyList = ["t", "v"], modifiers = False, timeStamped = False)

win.close()

Thanks in advance for your help!

To add some other info about this issue :

  • the issue does not occur when the window is not fullscreen (fullscr = False)
  • the issue occurs right away after the call to MoviwStim3

You really should migrate away from the deprecated event module and use the new Keyboard class instead:

https://www.psychopy.org/api/hardware/keyboard.html

I don’t think Keyboard actually has a .waitKeys() method though, so you’ll need to use .getkeys() in a loop.

Having said that, I don’t know if it will fix this issue, but Keyboard is superior in so many ways (including that it monitors the USB bus directly for events, rather than relying on the OS associating events to particular windows), so I suspect it will.

Thank you, I did this modification and it works now.
Thanks a lot !