Random position stimuli outside edges of screen

OS (e.g. Win10):
macOS Ventura13.0

PsychoPy version (e.g. 1.84.x):
PsychoPy v2022.2.4

Hello everyone.

I am making a visual search task consisting of 1 target and 50 distractors. I have set the target and distractors to be in a new random position for every repeat. Like this:
pos:(random()-0.5, random()-0.5)

The problem is that the stimuli sometimes show up slightly outside the edges of the screen when I run the experiment.

I tried to change the spatial units of the stimuli and change the screen width in the monitor center just to see, but I can’t seem to solve this.

Does anyone know how to prevent this from happening? Thank you so much.

Are you using height units? If so, then I would only expect your items to go off the top and bottom of a landscape screen. The issue, I think, is that you are forgetting the size of the object itself. Something positioned at (0,.5) will be half off the top of the screen.

Great. Changing units from height to norm fixed the problem. Thank you so much for your help