jacanterbury
jacanterbury

Reputation: 1505

textStim.text assignment functions different from setText() method call

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?

Upvotes: 0

Views: 269

Answers (1)

jacanterbury
jacanterbury

Reputation: 1505

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.

Upvotes: 1

Related Questions