def main()
global FPSCLOCK, DISPLAYSURF, BASICFONT, RESET_SURF, NEW_SURF, NEW_RECT, SOLVE_SURF, SOLVE_RECT
pygame.init()
FPSCLOCK = psygame.time.Clock()
screen = psygame.display.set_mode(WINDOWWIDTH, WINDOWHEIGHT)
pygame.display.set_caption('puzzle')
BASICFONT = pygame.font.Font('freesansbold.ttf', BASICFONTSIZE)
代码结束:
if __name__ == '__main__':
main()
这就是我的main()代码的样子,但当我运行代码(玩游戏、拼图)时,控制台会显示“File”拼图.py,模块>;中的第330行;。我做错什么了?你知道吗
命令提示符(启动游戏后):
Traceback (most recent call last):
File "puzzle.py", line 330, in <module>
main()
File "puzzle.py", line 46, in main
screen = pygame.display.set_mode(WINDOWWIDTH, WINDOWHEIGHT)
TypeError: must be 2-item sequence, not int
根据Pygame's documentation,方法
set_mode
需要元组作为第一个参数(而不是int
)。你知道吗我想你的台词
应该是
相关问题 更多 >
编程相关推荐