0

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)

0

1 Answer 1

2

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")

Sign up to request clarification or add additional context in comments.

5 Comments

why is my screen blank(black)?
@stack If you didn't replace "Small" in the default value to textToButton with "small" (exactly matching your switch in textObj) nothing is rendered since it doesn't match a font size. If you fixed that and it still doesn't give any output, is there any error message displayed?
no error message is given. the output is just blank(black)screen
@stack Seems you're rendering the text in black, so if the background is black you may want to pass another color to textToButton("Start",black,240,200,120,50).
refer to this stackoverflow.com/questions/35682471/… , I just posted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.