[solved] Mouse questions
Hi I have a couple of questions about mouse responses.
- I want to limit mouse responses to a specific area within the sketchpad. How con I do this?
- There is a possibility that the study is done in multiple sites that maybe have computers with different resolutions. Is the position from mouse-clicks going to be recorded different in different computers with different resolutions?
Thanks for the help!
Comments
Hi,
To allow mouse responses only in a certain area of the display you will need a little bit of inline coding. The following scripts should give you an idea of how to achieve this. Simply put the scripts in the Prepare phase and the Run phase tab of an inline_code item respectively:
Prepare phase:
[pastebin:hTpUQtLy]
Run phase:
[pastebin:xZECi2rL]
With regard to your question about screen resolutions I would like to refer you to a previous thread (especially the last couple of posts):
Did you like my answer? Feel free to

Thank you very much!
This helped a lot
I have a couple of questions though:
1a. If I leave the mouse_response item it seems I need 2 clicks to get a response. To solve this I got rid of the mouse_response and got the position and time from the my_mouse.get_click() data.
However, by getting rid of the mouse_response I loose the option to flush extra clicks.
I typed my_mouse.flush() at the end of the inline script but that didn't work.
1b. I collected RT as mouse_timestamp - self.get('time_my_sketchpad')
Does this sound right?
Hi,
To clear all pending output you should call the flush() function before the get_click() function. This is exactly how the mouse_response item works as well. So:
If this does not solve your problem, perhaps your program is waiting for a mouse response twice? For example because you also appended a mouse_response item to your sequence, or because the duration of a sketchpad is set to 'mouseclick'? This is not necessary, because the response is already collected via your inline script.
Yes, it does!
To achieve this you will have to communicate directly with PyGame. Note that the following script is will therefore only work with the PyGame and Expyriment back-ends, and not with PsychoPy.
[pastebin:ePQVJEfP]
I posted a small example experiment here (simply download and save with the extension '.opensesame'):
I hope this helps. Please let us know if you have any further questions!
Best,
Lotje
Did you like my answer? Feel free to

Thanks worked great!