import shaders as _shaders try : from pyglet import media havePygletMedia = True except Exception : havePygletMedia = False # lazy_import puts pygame into the namespace but delays import until needed lazy_import ( globals (), "import pygame" ) DEBUG = False IOHUB_ACTIVE = False retinaContext = None # only needed for retina-ready displays class OpenWinList ( list ): """Class to keep keep track of windows that have been opened. import globalVars try : from PIL import Image except ImportError : import Image import numpy from re import rush reportNDroppedFrames = 5 # stop raising warning after this # import pyglet.gl, pyglet.window, pyglet.image, pyglet.font, pyglet.event from. import backends # tools must only be imported *after* event or MovieStim breaks on win32 # (JWP has no idea why!) from import attributeSetter, setAttribute from import val2array from import convertToPix import as viewtools import as gltools from. environ = ' C: \\ Windows \\ SysWOW64' try : from dia import avbin haveAvbin = True except ImportError : haveAvbin = False # either avbin isn't installed or scipy.stats has been imported # (prevents avbin loading) except AttributeError : # avbin is not found, causing exception in pyglet 1.2? # (running psychopy 1.81 standalone on windows 7): # File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\ # pyglet\media\avbin.py", line 158, in # av.avbin_get_version.restype = ctypes.c_int # AttributeError: 'NoneType' object has no attribute # 'avbin_get_version' haveAvbin = False except Exception : # WindowsError on some systems # AttributeError if using avbin5 from pyglet 1.2? haveAvbin = False # for pyglet 1.3 if not haveAvbin : try : from import avbin haveAvbin = True except ImportError : haveAvbin = False except AttributeError : haveAvbin = False except Exception : haveAvbin = False import psychopy # so we can get the _path_ from psychopy import core, platform_specific, logging, prefs, monitors import psychopy.event from. platform = 'win32' : # make sure we also check in SysWOW64 if on 64-bit windows if 'C: \\ Windows \\ SysWOW64' not in os. colors import Color, colorSpaces haveAvbin = False # on windows try to load avbin now (other libs can interfere) if sys. import ctypes import os import sys import weakref import atexit from itertools import product from collections import deque from _import import lazy_import from psychopy import colors, event import math # from psychopy.clock import monotonicClock # try to find avbin (we'll overload pyglet's load_library tool and then # add some paths) from. # Distributed under the terms of the GNU General Public License (GPL). That should convert to a bunch of console.log statements you can see in your browser’s JS console, and it will help you figure out exactly which pieces of this aren’t working as intended.#!/usr/bin/env python # -*- coding: utf-8 -*- """A class representing a window for displaying one or more stimuli""" # Part of the PsychoPy library # Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd. Print("Completed ratings is exactly 1, ending routine") If slider.getRating() is not None: # Note *slider.getRating*, not sliderfiller.getRatingĬompleted_ratings = completed_ratings 1 Print("spacebar pressed, checking ratings") Auto->JS will directly convert print statements to console.log statements, so here’s what the Python might look like: keys = event.getKeys() # you'll still need to correct this after it's converted to JS I would recommend adding some logging statements to check which conditions are being met. However there may also be some issue in determining whether a rating has been filled out. So, if you are intending that they should advance after completing ALL ratings, then completed_ratings is greater than 1, not exactly 1. Right now, it will only end on spacebar press if completed_ratings is exactly 1, but your code increments completed_ratings for each rating that is not null. This is probably going to boil down to a logic issue with the conditional statements, but I also see an issue in the for loop.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |