Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Problem with entering non-ascii characters in text input form with psychoPy backend


I have encountered what seems like a bug when creating custom text input forms using OpenSesame with psychoPy backend. When entering any special character in a text input field (e.g. äöüß), the program ends with

TypeError: unsupported operand type(s) for &: 'float' and 'int'

The program ends as soon as the character is entered and I cannot avoid this by defining key_filters. I also have not found a function to set text_input fields to UTF-8. This is with psychoPy backend, with xpyriment no errors occur. A working simple program recreating this problem on my computer is below.

Is this known or is there a solution (besides using another backend)?

API: 2.1
OpenSesame: 3.2.8
Platform: nt
set width 1024
set uniform_coordinates yes
set title "New experiment"
set subject_parity even
set subject_nr 0
set start experiment
set sound_sample_size -16
set sound_freq 48000
set sound_channels 2
set sound_buf_size 1024
set sampler_backend legacy
set round_decimals 2
set mouse_backend psycho
set keyboard_backend psycho
set height 768
set fullscreen no
set form_clicks no
set foreground white
set font_underline no
set font_size 18
set font_italic no
set font_family mono
set font_bold no
set experiment_path "c:\\Program Files (x86)\\OpenSesame\\share\\opensesame_resources\\templates"
set disable_garbage_collection yes
set description "The main experiment item"
set coordinates uniform
set compensation 0
set color_backend psycho
set clock_backend psycho
set canvas_backend psycho
set background black

define sequence experiment
   set flush_keyboard yes
   set description "Runs a number of items in sequence"
   run new_inline_script always

define inline_script new_inline_script
   set description "Executes Python code"
   thisQuestion=u'Please enter your answer'
   # Create a form
   form = Form(
      cols=[1], rows=[2,1],
      margins=(50,100,50,100), spacing=25

   #add widgets
   form.set_widget(Label(text=thisQuestion, center=False), (0,0))
   textInput=TextInput(return_accepts=True, stub=u'Answer')
   form.set_widget(textInput, (0,1))   
   set _prepare ""


Sign In or Register to comment.