[Tutor] Type error when doing Pygame
Alan Gauld
alan.gauld at btinternet.com
Sat Sep 28 04:22:13 EDT 2019
On 28/09/2019 08:48, Cravan wrote:
> class Game:
>
> def food_food(self, x, y, cool):
>
>
> And here’s the Error I’m receiving:
>
>
>
> ################################
>
> Traceback (most recent call last):
>
>
> File "final_project.py", line 65, in draw
>
> self.food_food(screen, 5, 5, self.food_bar)
>
> TypeError: food_food() takes 4 positional arguments but 5 were given
The definition says 4 parameters including the implicit self.
But you pass 4 parameters plus self. Hence the error.
It looks as if you are passing an extra value - presumably 'screen'
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list