File: tutorial1.py

package info (click to toggle)
psychopy 1.73.06.dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,900 kB
  • sloc: python: 29,941; makefile: 153; sh: 20
file content (22 lines) | stat: -rw-r--r-- 645 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from psychopy import visual, core, event #import some libraries from PsychoPy

#create a window
mywin = visual.Window([800,600],monitor="testMonitor", units="deg")

#create some stimuli
grating = visual.PatchStim(win=mywin, mask='circle', size=3, pos=[-4,0], sf=3)
fixation = visual.PatchStim(win=mywin, size=0.2, pos=[0,0], sf=0, rgb=-1)

#draw the stimuli and update the window
while True: #this creates a never-ending loop
    grating.setPhase(0.05, '+')#advance phase by 0.05 of a cycle
    grating.draw()
    fixation.draw()
    mywin.flip()

    if len(event.getKeys())>0: break
    event.clearEvents()

#cleanup
mywin.close()
core.quit()