I trying to run below mentioned program in python spyder 3.6, 64 bit on windows 10 64 bit. When I run the code it is not accepting any mouse key. I am able to move the cursor but when I try to click on rating scale nothing is happning. What could be the problem? This code is the first part of the rating scale program in Demos. Thank you.
code:
from __future__ import division
from __future__ import print_function
from psychopy import visual, event, core, logging
import os
# create a window before creating your rating scale, whatever units you like:
win = visual.Window(fullscr=False, size=[1100, 800], units='pix', monitor='testMonitor')
instr = visual.TextStim(win, text="""This is a demo of visual.RatingScale(). There are four examples.
Example 1 is on the next screen. Use the mouse to indicate a rating: click somewhere on the line. You can also use the arrow keys to move left or right.
To accept your rating, either press 'enter' or click the glowing button. Pressing 'tab' will skip the rating.
Press any key to start Example 1 (or escape to quit).""")
event.clearEvents()
instr.draw()
win.flip()
if 'escape' in event.waitKeys():
core.quit()
# Example 1 --------(basic choices)--------
# create a RatingScale object:
myRatingScale = visual.RatingScale(win, choices=['cold', 'cool', 'hot'])
# Or try this one:
# myRatingScale = visual.RatingScale(win, choices=map(str, range(1, 8)), marker='hover')
# the item to-be-rated or respond to:
myItem = visual.TextStim(win, text="How cool was that?", height=.12, units='norm')
# anything with a frame-by-frame .draw() method will work, e.g.:
# myItem = visual.MovieStim(win, 'jwpIntro.mov')
event.clearEvents()
while myRatingScale.noResponse: # show & update until a response has been made
myItem.draw()
myRatingScale.draw()
win.flip()
if event.getKeys(['escape']):
core.quit()
print('Example 1: rating =', myRatingScale.getRating())
print('history =', myRatingScale.getHistory())
when I press ‘escape’ key, the window is not closing. I am also putting the trace back.
runfile('C:/Users/ravikumar.mevada/Gustometer/qmix/examples/rating2.py', wdir='C:/Users/ravikumar.mevada/Gustometer/qmix/examples')
An exception has occurred, use %tb to see the full traceback.
SystemExit: 0
c:\program files\python36\lib\site-packages\IPython\core\interactiveshell.py:2971: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)