# Save mouse click in pixel when experiment is in degree

**URL:** <https://discourse.psychopy.org/t/save-mouse-click-in-pixel-when-experiment-is-in-degree/26518>\
**Category:** Builder\
**Tags:** mouse\
**Created:** [December 17, 2021, 12:31pm UTC](https://discourse.psychopy.org/t/save-mouse-click-in-pixel-when-experiment-is-in-degree/26518 "2021-12-17T12:31:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnnaPy](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@AnnaPy](https://discourse.psychopy.org/u/AnnaPy)\
**Post date:** [December 17, 2021, 12:31pm UTC](https://discourse.psychopy.org/t/save-mouse-click-in-pixel-when-experiment-is-in-degree/26518/1 "2021-12-17T12:31:47Z")

</div>

I made an experiment in the Builder that is completely coded in degree (Line Bisection).  
Now I would like to save the mouse click also in pixel, to be able to compare the “real” distance of the clicks and not just in degree.  
Is there a way to save the mouse click twice, once in degree (already working) and once in pixel?

Thanks in advance 🙂

---

<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:** [December 17, 2021, 1:16pm UTC](https://discourse.psychopy.org/t/save-mouse-click-in-pixel-when-experiment-is-in-degree/26518/2 "2021-12-17T13:16:07Z")

</div>

If you find the position in degrees for the edge of the screen (call it degxMax) then you could convert back to pixels using

```auto
mousexPositionInDegrees / degxMax * screenWidthInPixels / 2

```

You could also find degxMax using trigonometry, which I could work out if necessary since

mousexPositionInDegrees = tan(mousexPositionInPixels/distance to screen)

So

mousexPositionInPixels = tan-1(mousexPositionInDegrees) \* distance to screenCM \* screenWidthInPixels / screenWidthInCM

I can’t guarantee I’ve got this correct.

---

<div class="post-metadata">

**Author:** ![TParsons](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/tparsons/32/8301_2.png) [@TParsons](https://discourse.psychopy.org/u/TParsons)\
**Post date:** [December 22, 2021, 11:49pm UTC](https://discourse.psychopy.org/t/save-mouse-click-in-pixel-when-experiment-is-in-degree/26518/3 "2021-12-22T23:49:05Z")

</div>

In the next release (2022.1.0) we’re adding some tools on the backend to make these conversions easier - you’ll be able to do this:

```auto
pos = layout.Position(mouse.getPos(), 'deg', win)

```

and then get these coordinates in any unit space using a `.`, like so:

```auto
pos.pix

```

We’re hoping to get this release out early in the new year
