Hi,
I’m trying to conduct an online experiment and I have to create procedures that can be run on both Windows and MacOS system computers. I use TextBox2 component to enable participants to write essays. The component works on a Windows system computer, even if I input multiple Chinese characters at the same time. But when I input multiple Chinese characters on a MacOS system computer, some errors happen.
Traceback (most recent call last):
File "_ctypes/callbacks.c", line 234, in 'calling callback function'
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/pyglet/libs/darwin/cocoapy/runtime.py", line 1128, in objc_method
result = f(py_self, *args)
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/pyglet/window/cocoa/pyglet_textview.py", line 78, in insertText_
self._window.dispatch_event("on_text", text)
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/pyglet/window/__init__.py", line 1333, in dispatch_event
if EventDispatcher.dispatch_event(self, *args) != False:
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/pyglet/event.py", line 415, in dispatch_event
if getattr(self, event_type)(*args):
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/backends/pygletbackend.py", line 429, in onText
currentEditable._onText(evt)
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/textbox2/textbox2.py", line 966, in _onText
self.addCharAtCaret(chr)
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/textbox2/textbox2.py", line 410, in addCharAtCaret
self._layout()
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/textbox2/textbox2.py", line 483, in _layout
if self._styles[i] == NONE:
IndexError: list index out of range
Traceback (most recent call last):
File "/Users/weiziqian/OneDrive/Documents/py_project/exp1/writing_control/exp_MacOS/main.py", line 52, in <module>
run_writing_task()
File "/Users/weiziqian/OneDrive/Documents/py_project/exp1/writing_control/exp_MacOS/writing_task.py", line 155, in run_writing_task
words = removePunctuation(textbox.text)
File "/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/visual/textbox2/textbox2.py", line 360, in text
if styles[i] == ITALIC and lastFormatter != styles[i]:
IndexError: list index out of range
In addition, it seems TextBox2 cannot insert line break automatically.
Any help is appreciated.
Computer system: MacOS Monterey 12.0.1
PsychoPy version: StandalonePsychoPy-2021.2.3-macOS