# Wakefield's Daily Tips

**URL:** <https://discourse.psychopy.org/t/wakefields-daily-tips/43371>\
**Category:** Blog\
**Tags:** online, pavlovia\
**Created:** [January 1, 2025, 3:36pm UTC](https://discourse.psychopy.org/t/wakefields-daily-tips/43371 "2025-01-01T15:36:55Z")\
**Posts on this page:** 1\
**Showing post:** 119

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [January 22, 2026, 12:36pm UTC](https://discourse.psychopy.org/t/wakefields-daily-tips/43371/119 "2026-01-22T12:36:21Z")

</div>

## Use setAutoDraw() not draw()

Locally the logic is that if you draw an object in Each Frame code it will be drawn for that frame only, so it seems inviting to use .draw() for stimuli which you only want to be present for some frames in the routine. Unfortunately, this doesn’t work online, as this demo will show you.

> **[draw \[PsychoPy\]](https://run.pavlovia.org/test-suite/draw/)**

text.draw() in Each Frame has the same effect in PsychoJS as text.setAutoDraw(True).

I therefore recommend that for objects designed to be shown for the entire routine, you use .setAutoDraw(True) in Begin Routine and .setAutoDraw(False) in End Routine.

If you want to control stimuli in Each Frame code, I would recommend checking the current value first, so change text.draw() to:

```auto
if not text.autoDraw():
     text.setAutoDraw(True)

```

and when you want to stop drawing use the opposite:

```auto
if text.autoDraw():
     text.setAutoDraw(False)

```

The code in my demo looks something like this:

```auto
if t < 1 or t > 2:
    if not text.autoDraw:
        text.setAutoDraw(True)
elif text.autoDraw:
     text.setAutoDraw(False)

```

> [@Pavlovia won't clear window](https://discourse.psychopy.org/t/pavlovia-wont-clear-window/42831):
>
> URL of experiment: [Chromasthesia [PsychoPy]](https://run.pavlovia.org/mboquoi/chromasthesia) Description of the problem: This is a bug fixing test run of my experiment. The main issue I experience is that the window won’t be cleared after the routine ends. Basically after “Uebung\_Abfrage” the window should be cleared, the new stimulus should be presented and only after it has been presented should “Uebung\_Abfrage” present itself with the colour wheel. It doesnt do that, however, it just stays, even after the loop has finished (which is after …

---

_[View the full topic](https://discourse.psychopy.org/t/wakefields-daily-tips/43371)._
