Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 18732

How can I fix a bug with a NoneType error? [closed]

$
0
0

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'


Viewing all articles
Browse latest Browse all 18732

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>