turtle.onclick() function in Python Last Updated : 26 Jul, 2020 Comments Improve Suggest changes Like Article Like Report The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.onclick() This function is used to bind fun to a mouse-click event on this turtle or on canvas. Syntax : turtle.onclick(fun, btn=1, add=None) Parameters: ArgumentsDescriptionfuna function with two arguments, to which will be assigned the coordinates of the clicked point on the canvasbtnnumber of the mouse-button defaults to 1 (left mouse button)addTrue or False. If True, the new binding will be added, otherwise, it will replace a former binding Below is the implementation of the above method with some examples : Example 1 : Python3 # import package import turtle # method to action def fxn(x,y): # some motion turtle.right(90) turtle.forward(100) # turtle speed to slowest turtle.speed(1) # motion turtle.fd(100) # allow user to click # for some action turtle.onclick(fxn) Output : Example 2 : Python3 # import package import turtle # screen object wn = turtle.Screen() # method to perform action def fxn(x, y): turtle.goto(x, y) turtle.write(str(x)+","+str(y)) # onclick action wn.onclick(fxn) wn.mainloop() Output : Comment More infoAdvertise with us Next Article turtle.onclick() function in Python D deepanshu_rustagi Follow Improve Article Tags : Python Python-turtle Practice Tags : python Similar Reads turtle.onscreenclick() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.onscreenclick() This function is used to bind fun to a mouse-click event on 2 min read turtle.onkey() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.onkey() This function is used to bind fun to the key-release event of the ke 1 min read turtle.ontimer() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.ontimer() This function is used to install a timer, which calls fun after t 1 min read turtle.ondrag() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.ondrag() This function is used to bind fun to mouse-move event on this turtl 1 min read turtle.isdown() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.isdown() This method is used to check whether the turtle is down or not. It 1 min read turtle.mode() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.mode() This function is used to set turtle-mode ('standard', 'logo' or 'worl 1 min read turtle.onrelease() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.onrelease() This function is used to bind fun to the mouse-button-release ev 2 min read turtle.numinput() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.numinput() This function is used to pop up a dialog window for the input of 1 min read turtle.dot() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.dot()This function is used to draw a circular dot with a particular size, wi 2 min read turtle.getpen() function in Python The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses Tkinter for the underlying graphics, it needs a version of Python installed with Tk support. turtle.getpen() This function is used to return the Turtleobject itself. It doesn't 1 min read Like