WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Number Pad input (https://forum.worldviz.com/showthread.php?t=6025)

mattyi 06-12-2017 07:26 AM

Number Pad input
 
Hi all,

I'm hoping that someone knows how to get vizact.onkeydown to recognize a number pad input. For example, if I enter:


Code:

vizact.onkeydown('0',myFunction)
Vizard will recognize the 0 above the letters on my keyboard, but not the 0 on the number pad. What do I use to get it to recognize the characters from that source?

I ask because I've created a simple response time task using vizard which tracks the workload of subjects in a behavioral study. There is limited space in the environment where the study is being run, and a small USB number pad is a pretty good input device that takes up very little space.

Jeff 06-13-2017 10:02 PM

Try using key codes instead of numbers to get the number pad key events:
Code:

def printKey(key):
        print key
       
vizact.onkeydown(viz.KEY_KP_0,printKey,'KP_0')
vizact.onkeydown(viz.KEY_KP_1,printKey,'KP_1')
vizact.onkeydown(viz.KEY_KP_2,printKey,'KP_2')
vizact.onkeydown(viz.KEY_KP_3,printKey,'KP_3')



All times are GMT -7. The time now is 03:48 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC