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.
This function is used to bind fun to mouse-move event on this turtle on canvas.
Syntax : turtle.ondrag(fun, btn, add)
- fun : a function with two arguments, to which will be assigned the coordinates of the clicked point on the canvas
- btn : number of the mouse-button defaults to 1 (left mouse button)
- add : True or False. If True, new binding will be added, otherwise it will replace a former binding
Below is the implementation of the above method with an example :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python - Call function from another function
- Wand function() function in Python
- Returning a function from a function - Python
- wxPython - GetField() function function in wx.StatusBar
- How to write an empty function in Python - pass statement?
- Function Decorators in Python | Set 1 (Introduction)
- Vulnerability in input() function – Python 2.x
- Function Annotations in Python
- Sorted() function in Python
- Ways to sort list of dictionaries by values in Python - Using lambda function
- Python Numbers | choice() function
- Python | askopenfile() function in Tkinter
- Python | Binding function in Tkinter
- floor() and ceil() function Python
- ord() function in Python
- round() function in Python
- id() function in Python
- vars() function in Python
- Print powers using Anonymous Function in Python
- Zip function in Python to change to a new character set
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.