Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Check whether a particular x,y coordinate falls within the circle

I found this:

To check whether a particular x,y coordinate falls within the bounding rectangle of an element, you can use in:

my_mouse = Mouse(visible=True)
my_canvas = Canvas()
my_canvas['rect'] = Rect(-100, -100, 200, 200)
button, (x, y), time = my_mouse.get_click()
if (x, y) in my_canvas['rect']:
        print('Clicked in rectangle')
        print('Clicked outside of rectangle')

However, this does not work for circles, right?

Do I have to change something if i try this for circles? Is there a workaround apart from using rectangles?


  • I noticed that it is not a problem of the circels as it actually works in window mode. However, it does not work in full screen mode.

  • You mentioned in the other script that this problem has been solved. Is that true?

    If not, did you check that the coordinates of the click and the stimuli match, even though they somewhat overlap? You can print out the respective variables in the debug window.


Sign In or Register to comment.