| Reference | Downloads | Github

Textbox questions

Hi all,

I have small question related to the use of the textbox (textbox 2 psychopy it says): I am trying to code whether an answer was correct (1) or not (0). In order to do so, I compare the answer in the textbox to the actual stimulus (both string variables)

first I define: text = ‘Antwort:’ + wordu1
(because it was not possible to use an empty textbox with only a cursor, in this case psychopy would say text.replace was nonetype)

Then in a next routine box (but within the same trial) I test the following:

if text == textbox_4.text:
score = score + 1
score = score + 0

Screen Shot 2021-01-07 at 11.18.03 AM

Although my result data file shows that the text and textbox are the same the score does not add up… Does this have to do with features of the textbox maybe?

Thanks for thinking along in advance!

Best regards, Sanne

Hi all,

Sorry to bother you. Does someone maybe have experience with using the text in the textbox further in the code? So (as shown above) I use the textbox answer to compare it to the correct answer, but then when both answers are the same, my variable ‘score’ does not count is as correct…

Hope someone know how this is possible, please also let me know if my question is unclear,

Best regards, Sanne