0

My reading of the docs here is that I should be able to use mytextstim.text="test" and mytextstim.setText("test") interchangeably however I find that the direct assignment doesn't seem to be working.

e.g. in code sample below

#!/usr/bin/env python2
#from psychopy import visual, core, data, event, gui
from psychopy import visual, core

myWin = visual.Window( allowGUI=True, fullscr=True)

jstim= visual.TextStim(myWin,text="start", alignVert="center",alignHoriz="center",height=0.1)
jstim.draw()
myWin.flip()
print("1: " + jstim.text)
core.wait(2)

jstim.text = "changed via direct assignment"
jstim.draw()
myWin.flip()
print("2: " + jstim.text)
core.wait(2)

jstim.setText("changed via method call")
jstim.draw()
myWin.flip()
print("3: " + jstim.text)
core.wait(2)

The middle section with jstim.text = "changed via direct assignment" does not get updated on the screen (although the attribute IS updated as seen from the print() statement) so I assume I've misunderstood something.

Any ideas?

jacanterbury
  • 1,435
  • 1
  • 26
  • 36

1 Answers1

1

I've just updated to v1.81.02 and it's resolved the problem.

i.e. the middle section DOES cause the textStim to update on screen.

I'm pretty sure I was on the immediately preceding version before.

jacanterbury
  • 1,435
  • 1
  • 26
  • 36
  • Yes, you're right. This is a relatively new feature so upgrading should solve it for everyone. ``setText()`` is preserved for backward compatibility and because you can microcontrol logging ``setText('something', log=False)`` if you want to deviate from the ``autoLog`` attribute. – Jonas Lindeløv Nov 08 '14 at 12:15