Synching drawing to vertical blanking interval?

I've written a small wxPython application for a psychologist colleage of mine that measures certain features of human vision. The applicaiton presents an image and the subject responds by tapping a key. Record data, lather, rinse, repeat.

The problem is that my colleague would now like to precisely time the interval between image presentation and key press. Based on a bit of quick research it looks like the major source of error in the measurement will be screen refresh --- at 75 Hz there's as much as 12.5ms of uncertainty as to when an image actually appears on the screen.

There's also keyboard latency involved here. By the time your app sees a WM_CHAR or WM_KEYDOWN message, a significant and unpredictable amount of time has elapsed since the key was actually pressed. The delay is different for PS/2 and USB keyboards, and wireless keyboards are worse yet.

Is there any way to synchronize drawing to the vertical blanking interval from wxPython? Thanks,

Not with GDI. The standard Windows display driver interface doesn't even acknowledge the concept of vertical refresh. You would have to use DirectDraw to do this. I do not know if someone has conconcted a DirectX interface in Python.

ยทยทยท

On Thu, 06 Jan 2005 11:04:16 -0500, Greg Phillips <greg.phillips@rmc.ca> wrote:

--
- Tim Roberts, timr@probo.com
  Providenza & Boekelheide, Inc.