Advertisement
Guest User

Untitled

a guest
Jan 30th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. # Generated by OpenSesame 0.27 (Frisky Freud)
  2. # Wed Jan 30 11:58:44 2013 (posix)
  3. # <http://www.cogsci.nl/opensesame>
  4.  
  5. set foreground "white"
  6. set subject_parity "even"
  7. set font_size "18"
  8. set description "Default description"
  9. set title "New experiment"
  10. set font_bold "no"
  11. set compensation "0"
  12. set coordinates "relative"
  13. set height "768"
  14. set mouse_backend "xpyriment"
  15. set width "1024"
  16. set sampler_backend "legacy"
  17. set font_family "mono"
  18. set keyboard_backend "legacy"
  19. set background "black"
  20. set subject_nr "0"
  21. set canvas_backend "xpyriment"
  22. set start "experiment"
  23. set synth_backend "legacy"
  24. set font_italic "no"
  25.  
  26. define sequence sequence
  27. run inline_script "always"
  28. run sketchpad "always"
  29.  
  30. define sketchpad sketchpad
  31. set duration "1000"
  32. set description "Displays stimuli"
  33. draw textline 32.0 -128.0 "accepted" center=1 color=white font_family="mono" font_size=18 font_italic=no font_bold=no show_if="always"
  34.  
  35. define sequence experiment
  36. run loop "always"
  37.  
  38. define inline_script inline_script
  39. ___run__
  40. # Keep pulling mouse responses until the participant
  41. # clicked in the area of interest:
  42.  
  43. # Make sure the cursor appears at the center of the screen:
  44. # See also: http://www.pygame.org/docs/ref/mouse.html#pygame.mouse.set_pos
  45.  
  46. # Determine center coordinates:
  47. xCen = exp.width/2
  48. yCen = exp.height/2
  49.  
  50. import pygame
  51. pygame.mouse.set_visible(True)
  52. pygame.mouse.set_pos((xCen,yCen))
  53. self.sleep(100)
  54.  
  55. while True:
  56.  
  57. # get_click() returns a button, position, timestamp tuple:
  58. # See also: http://osdoc.cogsci.nl/python-inline-code/mouse-functions/#mouse.get_click
  59. my_mouse.flush()
  60. button, pos, timestamp = my_mouse.get_click()
  61.  
  62. # pos contains an (x,y) tuple:
  63. x, y = pos
  64.  
  65. # If both the x and the y coordinates fell within
  66. # the area, break out of the while loop:
  67. if (x > xMin and x < xMax) and (y > yMin and y < yMax) :
  68. break
  69. __end__
  70. ___prepare__
  71. # Initialize a mouse object:
  72. # See also: http://osdoc.cogsci.nl/python-inline-code/mouse-functions/#mouse.__init__
  73. from openexp.mouse import mouse
  74. global my_mouse
  75. my_mouse = mouse(exp, visible = True)
  76.  
  77. # In this example the area of interest is a rectangle and
  78. # is determined relative to the resolution of the screen (and not in
  79. # absolute values). You can change the minima and maxima
  80. # to your specific situation.
  81.  
  82. # Determine the center of the screen by using the
  83. # built-in variables width and height:
  84. global xCen, yCen
  85. xCen = exp.width/2
  86. yCen = exp.height/2
  87.  
  88. global xMin, xMax, yMin, yMax
  89. xMin = xCen-exp.width/4
  90. xMax = xCen+exp.width/4
  91.  
  92. yMin = yCen-exp.width/4
  93. yMax = yCen+exp.width/4
  94.  
  95. # To visually check whether you defined the
  96. # area of interest correctly you could use a canvas object
  97. # (simply remove or deactivate this piece of code if you don't need
  98. # it any more).
  99.  
  100. # Initialize a canvas object:
  101. # See also: http://osdoc.cogsci.nl/python-inline-code/canvas-functions/#canvas.__init__
  102. from openexp.canvas import canvas
  103. global my_canvas
  104. my_canvas = canvas(exp)
  105.  
  106. # determine the width and height of the area of interest:
  107. w = xMax - xMin
  108. h = yMax - yMin
  109.  
  110. # rect() draws a rectangle on the canvas:
  111. # See also: http://osdoc.cogsci.nl/python-inline-code/canvas-functions/#canvas.rect
  112.  
  113. my_canvas.rect(xMin, yMin, w, h)
  114. my_canvas.show()
  115. #self.sleep(2000)
  116. __end__
  117. set description "Executes Python code"
  118.  
  119. define loop loop
  120. set repeat "1"
  121. set description "Repeatedly runs another item"
  122. set skip "0"
  123. set offset "no"
  124. set item "sequence"
  125. set column_order ""
  126. set cycles "10"
  127. set order "random"
  128. run sequence
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement