[英]Type Error: Integer is required - Pygame , Python 2.7
I'm following a tutorial online , creating a button for pygame. 我正在关注在线教程,为pygame创建一个按钮。
textSurf,textRect = smallfont.render(msg,color,size)
I've just started learning pygame yesterday. 我昨天刚开始学习pygame。
I met with an error stating that "Type Error: Integer is require"
. 我遇到一条错误,指出
"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)
错误位于
textSurf,textRect = smallfont.render(msg,color,size)
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. ...以颜色作为第二个参数,以“小”作为第三个参数,但是要
render
的第二个和第三个参数应为抗锯齿标志和该顺序的颜色。
Since you have a function right above that translates "small" to the correct parameters to render, what you want is most likely; 由于上面有一个函数可以将“ small”转换为正确的参数以进行渲染,因此您最有可能想要的东西是:
textSurf,textRect = textObj(msg,color,size)
(although watch out for the casing of "Small" vs. "small") (尽管要注意“小”和“小”的大小写)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.