Python Program for Visual Reaction Time

I'm not a programmer. I am doing a project for Biology where I will be conducting an experiment on reaction times. Briefly, the subject should click anywhere on the screen as soon as a dot or circle (some graphic) appears on the screen.

Details:

  • Program must start at a set clock time (eg 16:03:00) which will be typed in every time
  • Timer must start when program starts (t=0)
  • Graphics will appear at the same point (coordinates) according to pre-determined times relative to start (eg, 1.5s, 2s, 3.5s, ...) for 2 minutes.
  • Each time the subject presses the mouse, the time relative to the timer must be recorded.
  • Afterward, I will just tabulate the data on a spreadsheet and calculate the time differences between the time the graphic appears and the time the subject presses the mouse.

    I have very limited knowledge of Python. I've never done anything with graphics on Python. This is the best set up I can think of for my needs.

    I did some research and this is what I've found so far:

  • For the graphics: Pyglet has a built in scheduling function (pyglet.clock.schedule_interval)
  • I can use either time.time or time.clock for measuring reaction times. I am kind of confused over which one to use. It seems there is some subtle difference that I'm not understanding.
  • Please also not that the program may be run on a windows 7 PC or a MacBook.

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


    You can use Pygame for graphics (drawing a dot on screen etc).

    You can use datetime to capture the start time:

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

    Pyhook will capture mouse movements.

    链接地址: http://www.djcxy.com/p/11442.html

    上一篇: textFieldDidBeginEditing被提前调用

    下一篇: 视觉反应时间的Python程序