Accessing the grave key through Windows

Hello,

I’m using version 2022.1.3 on my Windows 10 laptop. I have a block of code where I need the program to wait until it receives a signal from another device before progressing. The signal comes in as the grave key; however, on Windows I’m unsure which code that pertains to. I’ve looked at the keyboard source code to no avail. My current code is:

kb = keyboard.Keyboard()
text.text = "please wait"
text.draw()
win.flip()
while True:
    theseKeys = kb.getKeys(['quoteleft', 'escape', 'K_BACKQUOTE'])
            
    if "escape" in theseKeys:
        core.quit()
    if len(theseKeys):
        break

In the past when I used a Mac I was able to use the grave code, but that doesn’t appear to be an option for Windows. Currently, me code won’t progress when I press the grave key on my Windows laptop. Is there a way I can get around this?

From this chart I was able to see that the computer code for the grave key is 192. When I went back to the Psychopy3 Keyboard source code, I found that apostrophe has that code, which solves my problem. So the final code is:

kb = keyboard.Keyboard()
text.text = "please wait"
text.draw()
win.flip()
while True:
    theseKeys = kb.getKeys(['apostrophe', 'escape'])
            
    if "escape" in theseKeys:
        core.quit()
    if len(theseKeys):
        break
1 Like