Can't get responses from GetKeys

Hi folks,
I have what I believe is a simple question, but my search through the forum and the website didn’t turn up any answers, so I figured I’d just ask.

I find I’m unable to collect keypresses from the keyboard using event.getKeys(). I’ve tried looking for a set of keys, a specific key, or any key whatsoever, and the list is always blank (even when assigning to a variable). Here’s a simple example of what I mean:

finished = 0
while not finished:
    n+=1
    if n == 1:
        keystart = True
    message.draw()
    win.flip()
    if keystart:
        key_pressed = event.getKeys()
        if len(key_pressed) > 0:
            finished = 1

With this, the while loop never finishes, no matter how many keys I press. This is puzzling to me, as I’ve made other experiments using the Builder, and when exporting to Coder, this seems to be the syntax used and it works just fine (i.e. I can hit escape and it exits out of the experiment). Am I missing something with the getKeys command?

Thanks much,
Ryan

I think it will depend on what the values of n and keystart are; if n is > 0 and keystart is False, it will never reach the event.getKeys() statement.

Also, if you have a keyboard component set up in Builder as well, then event.getKeys will not work