python - Psychopy text wrap issue -
i trying replicate psychology experiment graduate thesis. pretty new psychopy , python coding. through online search managed add input text functionality experiment. there slight issue though: when participant inputs answer text not wrapped , goes beyond screen. wrapped text within components dialog box didn't work. code makes input text function possible below:
inputtext = "" cursorcounter=0 cursorvariable='|' thesekeys="" shift_flag = false text_3.alignhoriz ='left'` if cursorcounter >= 30: if cursorvariable=='|': cursorvariable=' ' else: cursorvariable='|' cursorcounter=0 cursorcounter+=1 n= len(thesekeys) = 0 while < n: if thesekeys[i] == 'return' , len(inputtext) > 4: # pressing return means time stop continueroutine = false break elif thesekeys[i] == 'backspace': inputtext = inputtext[:-1] # lose final character = + 1 elif thesekeys[i] == 'space': inputtext += ' ' = + 1 elif thesekeys[i] in ['lshift', 'rshift']: shift_flag = true = + 1 elif thesekeys[i] == 'period': inputtext = inputtext + "." = + 1 elif thesekeys[i] == 'comma': inputtext = inputtext + "," = + 1 else: if len(thesekeys[i]) == 1: # have 1 char should normal key, # otherwise might 'ctrl' or similar ignore if shift_flag: inputtext += chr( ord(thesekeys[i]) - ord(' ')) shift_flag = false else: inputtext += thesekeys[i] = + 1 inputtext = inputtext.capitalize() # let's store final text string results finle... thisexp.adddata('inputtext', inputtext) inputtext=""
there 1 little problem when inputted text large moves upwards , overlap other texts above question. believe these simple issues unfortunately lack knowledge fix them. glad if can me out!
Comments
Post a Comment