How can I create a stimulus that comes and goes of the screen every 5 seconds

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):
**Standard Standalone? (y/n):y
**What are you trying to achieve?: I am trying to create a visual stimulus for mice, however I am not able to make the pattern disappear and come back

**What did you try to make it work?: The pattern that I create does not disappear from the screen

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.

Hi, are you using builder? If so, could you please provide a screenshot of the routine that is playing up? There’s many possible reasons why your stimulus is not disappearing.
I suspect the main reason the pattern is not disappearing from the screen, is that another component is staying active. So you just need to make sure all your components end at the same time.

Alternatively, you could write in the ‘each frame’ tab of a code component:

RoutineDur = 5 # Desired routine duration in seconds
if t >= RoutineDur:
      continueRoutine = False # End routine after 5 seconds.

If it’s okay to still be clickable when hidden, the easiest way would be to set its opacity to update each frame and have the value be $(t % 10) < 5