Textstim_vs_textbox.py demo not working

The textstim_vs_textbox.py demo no longer seems to work. The problem seems to be that getFontManager is no longer defined in fontmanager.py, (psychopy/psychopy/visual/textbox/fontmanager.py at 057736cd951f2d313cb7bb4b11a55829a60a9441 · psychopy/psychopy · GitHub) did it get accidentally deleted?

The error I get from running the demo is

fm=visual.TextBox.getFontManager()
File “/Applications/PsychoPy2_1.84.2.app/Contents/Resources/lib/python2.7/psychopy/contrib/lazy_import.py”, line 112, in getattribute
return getattr(obj, attr)
AttributeError: type object ‘TextBox’ has no attribute ‘getFontManager’

I was looking at the demo because I am trying to draw individual letters very fast. I’m guessing that TextStim is always faster than TextBox for this? Thanks for any advice.

Alex

Hi Alex,

// .getFontManager() is defined in the textbox __init__.py rather than fontmanager.py . //

Try adding this import:

from psychopy.visual import textbox

and then access the font manager like this:

fm = textbox.getFontManager()

Looks like this demo might have fallen foul of some reorganisation of psychopy.visual that happened a while back.

Have made a pull request to fix this but perhaps someone who understands the visual importing better than me could do better?
https://github.com/psychopy/psychopy/pull/1364

1 Like