Python program for visual reaction time

I am not a programmer. I am doing a biology project where I will conduct an experiment on the reaction time. In short, the object should click anywhere on the screen as soon as a dot or circle (some kind of graphic) appears on the screen.

More details:

  • The program should start from the set time (for example, 16:03:00), which will be dialed every time
  • The timer should start when the program starts (t = 0)
  • Graphics will be displayed at the same point (coordinates) in accordance with a predetermined time relative to the beginning (for example, 1.5s, 2s, 3.5s, ...) for 2 minutes.
  • Each time an object clicks on the mouse, it is necessary to record the time relative to the timer.

After that, I simply collect the data in a spreadsheet and calculate the time difference between the graph display and the time that the object clicks on the mouse.

I have very limited knowledge of Python. I have never done anything with graphics in Python. This is the best I can think of for my needs.

I did some research, and this is what I have found so far:

  • For graphics: Pyglet has a built-in scheduling function (pyglet.clock.schedule_interval)
  • I can use time.time or time.clock to measure reaction time. I am a little confused than using. There seems to be some subtle difference that I don't understand.

Please also do not pay attention to the fact that the program can be launched on a computer with Windows 7 or MacBook.

I do not need a complete answer. Just some suggestions and tips to point me in the right direction for further research. Thanks.

+7
source share
1 answer

You can use Pygame for graphics (drawing a point on the screen, etc.).

You can use datetime to record the start time:

 from datetime import datetime Time = datetime.now() print(Time) 

Pyhook will capture mouse movements.

+3
source

All Articles