| Reference | Downloads | Github

"default text" appears before routines start

URL of experiment:

Description of the problem:
hello, I designed an experiment which gives the feedback about response. The problem is the text “default text” appears briefly and the routines begins.
I searched similar problems and read this.
["default text" Flashing at Beginning of Routines with FeedBack]

[Feedback from previous trial erronuously flashing at the beginning of a trial]

the solution is that i manually insert setText() function to the top of the each frame code.
I tried to do. Perhaps because I didn’t understand it correctly, the problem was not solved.

Actually, I’m am beginner about psychopy and pavlovia. So, I don’t know where the top of the each frame code and exactly what to insert.
I inserted simplely setText(); on the first line in Each Frame code properties. What I did couldn’t be the answer.

Please, help me.

Could you tell me more about this in detail?

If you set the msg text to “” or blank rather than undefined then you’ll briefly have a bank instead of “default text” while the variable catches up (a frame or two later).

thank you for reply
i saw this solution, too,
Maybe I’m not doing it right, but this solution didn’t solve the problem.

I understand this solution like this. is that right?
msg = “” or msg = " ";
Sadly, “default text” still appears.

Is there any other way?

Try Begin Experiment as well as Begin Routine.

I’m just guessing at the variable being msg. Please could you show the component and code related to the issue?

Thank you for your reply.
The problem was solved by chance by various attempts.
When I modified the “default text” to blank in JS code, the “default text” disappeared.

I really appreciate your help.

I wouldn’t recommend editing the JS code directly on Pavlovia because you will lose the edit next time sync from Builder.

I totally agree with you.
Is there any way I can modify it in the builder?
Before checking the code, please consider that this is a preliminary experiment.
this code is code before modification.
I don’t know code which related to the issue.
So, i copied code which containing msg.

// Initialize components for Routine “trial_2”
text = new visual.TextStim({
win: psychoJS.window,
name: ‘text’,
text: ‘default text’,
font: ‘Arial’,
units: undefined,
pos: [0, (- 0.25)], height: 0.1, wrapWidth: undefined, ori: 0,
color: new util.Color(‘red’), opacity: 1,
depth: -4.0

msg = " ";

//------Prepare to start Routine 'trial_2'-------
t = 0;
trial_2Clock.reset(); // clock
frameN = -1;
// update component parameters for each repeat
respond.keys = undefined;
respond.rt = undefined;
_respond_allKeys = [];
msg = "   ";

// *text* updates
if (t >= 0.0 && text.status === PsychoJS.Status.NOT_STARTED) {
  // keep track of start time/frame for later
  text.tStart = t;  // (not accounting for frame time here)
  text.frameNStart = frameN;  // exact frame index

if (text.status === PsychoJS.Status.STARTED){ // only update if being drawn
if (respond.keys) {
    if ((respond.keys.slice((- 1))[0] !== cor)) {
        msg = "X";
    } else {
        respond.corr = true;
        continueRoutine = false;

Please could you show your code components in Builder and the text component that you need to edit?

thank you for your reply…

this is code component

this is text component

Is this right? I don’t know if I showed you what you wanted.

Thank you

That all looks fine. However, I suspect that your code component is below your text component in the same routine. You need to move the code component up so it gets processed first.

Thank you for reply.

You’re right. Code component is below text component in the same routine.
So, I moved it up.

sadly, “default text” still appears.


Personally I do my best to avoid any “Each Frame” changes in Builder components, instead updating them in code.

In my template experiment I set the text field to nothing Constant. The, instead of editing a msg variable I use

if msg!= oldMsg:

Thank you for reply…
Finally, the “default text” no longer appears.
The problem was solved by combining the solutions mentioned earlier.
Specially, your code was helpful.

Thank you so much…