I'm in a class for basic python, and I'm trying to make a plane follow the mouse, but when I call the onMouseMove function, I get an error.
The code I put in is
def drawPlane(x, y): Oval(x, y, 50, 15, fill='darkGrey') Oval(x, y, 10, 50, fill='darkGrey') Polygon(x - 20, y + 5, x - 30, y + 5, x - 30, y - 15, fill='darkGrey') Rect(x - 30, y - 7, 30, 7, fill='darkGrey') Oval(x - 20, y, 3, 5, fill='cornflowerBlue') Oval(x - 15, y, 3, 5, fill='cornflowerBlue') Oval(x - 10, y, 3, 5, fill='cornflowerBlue') Oval(x - 5, y, 3, 5, fill='cornflowerBlue') Oval(x, y, 3, 5, fill='cornflowerBlue') Oval(x + 5, y, 3, 5, fill='cornflowerBlue') Oval(x + 10, y, 3, 5, fill='cornflowerBlue') Polygon(x + 15, y - 5, x + 20, y - 5, x + 25, y, x + 15, y, fill='cornflowerBlue') passplane = drawPlane(200, 200)def onMouseMove(mouseX, mouseY): plane.x = mouseX plane.y = mouseY pass
and when the mouse moves on the canvas, instead of the plane's x and y being mouseX and mouseY I get an error message saying
plane.x = mouseX
AttributeError: type object 'NoneType' has no attribute 'x'