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

**URL:** <https://discourse.psychopy.org/t/cannot-do-a-waitkey-after-playing-a-video-with-moviestim3/14272>\
**Category:** Coding\
**Created:** [June 15, 2020, 4:29pm UTC](https://discourse.psychopy.org/t/cannot-do-a-waitkey-after-playing-a-video-with-moviestim3/14272 "2020-06-15T16:29:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PCH313](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/pch313/32/5115_2.png) [@PCH313](https://discourse.psychopy.org/u/PCH313)\
**Post date:** [June 15, 2020, 4:29pm UTC](https://discourse.psychopy.org/t/cannot-do-a-waitkey-after-playing-a-video-with-moviestim3/14272/1 "2020-06-15T16:29:29Z")

</div>

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

```auto
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!

---

<div class="post-metadata">

**Author:** ![PCH313](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/pch313/32/5115_2.png) [@PCH313](https://discourse.psychopy.org/u/PCH313)\
**Post date:** [June 16, 2020, 2:28pm UTC](https://discourse.psychopy.org/t/cannot-do-a-waitkey-after-playing-a-video-with-moviestim3/14272/2 "2020-06-16T14:28:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/michael/32/16_2.png) [@Michael](https://discourse.psychopy.org/u/Michael)\
**Post date:** [June 17, 2020, 1:28am UTC](https://discourse.psychopy.org/t/cannot-do-a-waitkey-after-playing-a-video-with-moviestim3/14272/3 "2020-06-17T01:28:17Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![PCH313](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/pch313/32/5115_2.png) [@PCH313](https://discourse.psychopy.org/u/PCH313)\
**Post date:** [June 17, 2020, 10:21am UTC](https://discourse.psychopy.org/t/cannot-do-a-waitkey-after-playing-a-video-with-moviestim3/14272/4 "2020-06-17T10:21:28Z")

</div>

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