psychopy.org | Reference | Downloads | Github

How to set multiple objects autodraw setting, or clear the screen regardless

Is there a function to set setAutoDraw(false) for all objects on screen? Or have a myWin.clearDrawings() function?

Background
In my experiment I have several lines drawn on the screen which should remain there between button clicks. There are 8 lines presented on the screen and the participant has to bisect each line. With every bisection, their estimate is also drawn on the screen and should remain until all lines are bisected fpr that block of trials.

This is implemented using the visual.ShapeStim command and setting autodraw to True for each line and also its marking. Thus I have 16 objects with autodraw=True settings.

I’m currently running a loop for all the items at the end of a block to setAutoDraw(False) and then flip the screen, but I figure there must a better way to do this than that.

Thanks for your help!

I think you’ve already created that:

I’m currently running a loop for all the items at the end of a block to setAutoDraw(False)

I don’t think that here is a much better way to do it than that. (Yes, you can muck around in the undocumented weeds and set the window’s ._toDraw attribute to an empty list, but that only saves one line of code compared to your loop. And it would add more code later to re-populate the list. So stick with the obvious, and explicit, method you’ve already implemented.)

2 Likes