简体   繁体   中英

How to fix this TypeError?

I get this error: TypeError: clear() missing 1 required positional argument: 'self'

from this bit of code as far as I know:

  def drawHUD(self,score):
    self.hud.clear()
    self.hud.color("white")
    self.hud.penup()
    self.hud.hideturtle()
    self.hud.goto(0, -400)

I'm not really sure what to do. I'm expecting it to collide with the fruit and then grow longer and the fruit appears elsewhere

This means that the call to clear expects to be given an argument. In your call to clear you dont pass any.

You should take a look at its documentation and/or its declaration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM