So I want to create a button that you can click on in python.
I am making a very simple game with the python turtle module.
here's my code x
is the x position of the click and y
is the y position of the click.
screen = turtle.Screen() #for some context
def click(x, y):
if (x <= 40 and x <= -40) and (y <= 20 and y <= -20):
#code here
screen.onscreenclick(click)
I want it to do the run some code when i click in a specific area but this code doesn't work for me.
any help would be appreciated.
Thanks!