Search code examples
pythonpython-3.xpsychopy

Psychopy unexpected keyword argument 'languageStyle'


I saw that psychopy now has support for RTL language: http://www.psychopy.org/api/visual/textstim.html https://discourse.psychopy.org/t/reshaping-english-text-to-arabic/4235/16

I used this manual to install the latest version using conda: http://psychopy.org/installation.html

My version is: 1.90.2 with Python 3.5

However, when init TextStim with languageStyle I get an error:

from psychopy import visual 
text_stim = visual.TextStim(self.window, height = height, wrapWidth = wrapWidth, bold= True, text= sentence, pos = (0,0) , color='white', languageStyle='RTL')

Any idea how can I use it?


Solution

  • Yes, @deceze is correct, this feature in the latest beta, available for download from this page: https://github.com/psychopy/psychopy/releases rather than the latest stable release available from http://psychopy.org/installation.html

    EDIT: actually I see that you're installing PsychoPy via pip under Anaconda. I guess the pip version is also lagging behind the current beta release. You might need to clone or download from the PsychoPy GitHUb repository if you want the latest developer release running under your own Python installation.

    Note that this feature still doesn't handle multi-line text correctly in Python experiments (the text flows from right to left but also from bottom-to-top). This is due to a limitation in the underlying pyglet library we use for drawing text. However, the latest betas also allow for generating online Javascript experiments that can be run from a browser. These handle Arabic text correctly without any issues whatsoever (and with no need to specify the language style setting at all).