stack
stack

Reputation: 414

Type Error: Integer is required - Pygame , Python 2.7

I'm following a tutorial online , creating a button for pygame.

textSurf,textRect = smallfont.render(msg,color,size)

I've just started learning pygame yesterday.

I met with an error stating that "Type Error: Integer is require". What does this mean? Can someone help me out?

The error is located at textSurf,textRect = smallfont.render(msg,color,size)

Upvotes: 0

Views: 73

Answers (1)

Joachim Isaksson
Joachim Isaksson

Reputation: 180867

You're calling

textSurf,textRect = smallfont.render(msg,color,size)

...with a color as second parameter and "Small" as the third parameter, however the second and third parameter to render should be an antialiasing flag and a color in that order.

Since you have a function right above that translates "small" to the correct parameters to render, what you want is most likely;

textSurf,textRect = textObj(msg,color,size)

(although watch out for the casing of "Small" vs. "small")

Upvotes: 2

Related Questions