Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python blit错误的目标位置无效_Python_Pygame_Pygame Surface - Fatal编程技术网

Python blit错误的目标位置无效

Python blit错误的目标位置无效,python,pygame,pygame-surface,Python,Pygame,Pygame Surface,我犯了这个错误。这是完整的回溯 我没有任何线索。。。我该怎么办???的第二个参数(dest)是一对坐标。包含2个组件的元组或包含2个元素的列表: dis.blit(值、圆形(显示宽度/3)、圆形(显示高度/5)) dis.blit(值,(圆形(显示宽度/3)、圆形(显示高度/5))) 为了完整性起见,必须提到参数也可以是矩形。包含4个组件(左、上、宽、高)的元组。非常感谢。因为你的回答,我可以做到。 Traceback (most recent call last): File "C

我犯了这个错误。这是完整的回溯

我没有任何线索。。。我该怎么办???

的第二个参数(dest)是一对坐标。包含2个组件的元组或包含2个元素的列表:

dis.blit(值、圆形(显示宽度/3)、圆形(显示高度/5))

dis.blit(值,(圆形(显示宽度/3)、圆形(显示高度/5)))

为了完整性起见,必须提到参数也可以是矩形。包含4个组件(左、上、宽、高)的元组。

非常感谢。因为你的回答,我可以做到。
Traceback (most recent call last):
File "C:/Users/hobin/PycharmProjects/codeitPython/Snake_game.py", line 103, in <module>
snakegame()
File "C:/Users/hobin/PycharmProjects/codeitPython/Snake_game.py", line 52, in snakegame
dis.blit(value, round(display_width / 3), round(display_height / 5))
TypeError: invalid destination position for blit
while not game_over:
    while game_end == True:
        #For displaying the score
        score = Length_of_snake -1
        score_font = pygame.font.SysFont("comicsansms", 35)
        value = score_font.render("Your Score: " + str(score), True, greencolor)
        dis.blit(value, round(display_width / 3), round(display_height / 5))
        pygame.display.update()
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                game_over = True # The game window is still open
                game_end = False # game has been ended