How to handle clicks on a turtle and clicks off of a turtle separately?
问题 Using the Python 3 "turtle" module, I am trying to handle two different click conditions separately: If a turtle is clicked on, it should call a function. (In the example below, it should switch from black to red, or vice versa.) If a click is NOT on a (visible) turtle, a different function should be called (to create a turtle at that point). Right now I can make this work using two different mouse buttons, like so: #!/usr/local/bin/python3 import turtle sc = turtle.Screen() def new_turtle(x,