Python TypeError:必需参数';目的地';(位置2)未找到

Python TypeError:必需参数';目的地';(位置2)未找到,python,python-3.6,Python,Python 3.6,我正在尝试使用pygame制作射击游戏,但当我运行游戏时,它会显示pygame窗口,但给出一个错误: Traceback (most recent call last): File "C:\Users\Nnamdi\AppData\Local\Programs\Python\Python36-32\game.py", line 26, in <module> SCREEN.blit(text) TypeError: Required argument 'dest' (pos

我正在尝试使用pygame制作射击游戏,但当我运行游戏时,它会显示pygame窗口,但给出一个错误:

Traceback (most recent call last):
  File "C:\Users\Nnamdi\AppData\Local\Programs\Python\Python36-32\game.py", line 26, in <module>
  SCREEN.blit(text)
TypeError: Required argument 'dest' (pos 2) not found

希望您能提供帮助。

您必须定义
dest
变量。您还应该调用函数
pygame.display.flip()
。例如:

import pygame, sys
from pygame.locals import *

pygame.init()

ammo = "10" # you have ten ammo, use it wisely...

WIDTH = 600
HEIGHT = 600
SCREEN = pygame.display.set_mode((WIDTH, HEIGHT))

pygame.display.set_caption('Bomber')

WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
DARKBLUE = (2, 9, 129)
YELLOW = (255, 255, 255)

SCREEN.fill(DARKBLUE)
pygame.display.flip()
basicfont = pygame.font.SysFont(None, 48)
text = basicfont.render('Bomber', True, (255, 0, 0), (255, 255, 255))
dest = (100, 100)
is_running = True
while is_running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_running = False

    SCREEN.blit(text, dest)
    pygame.display.flip()

pygame.quit()
截图:


您能告诉我们整个错误吗?什么是
dest
?您的错误[
SCREEN.blit(text)
]中的第26行和您发布的代码[
SCREEN.blit(text,dest)
]中的第26行(当前)明显不同。这使得其中一个是不正确的。@LillyM。更新我的解决方案
import pygame, sys
from pygame.locals import *

pygame.init()

ammo = "10" # you have ten ammo, use it wisely...

WIDTH = 600
HEIGHT = 600
SCREEN = pygame.display.set_mode((WIDTH, HEIGHT))

pygame.display.set_caption('Bomber')

WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
DARKBLUE = (2, 9, 129)
YELLOW = (255, 255, 255)

SCREEN.fill(DARKBLUE)
pygame.display.flip()
basicfont = pygame.font.SysFont(None, 48)
text = basicfont.render('Bomber', True, (255, 0, 0), (255, 255, 255))
dest = (100, 100)
is_running = True
while is_running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_running = False

    SCREEN.blit(text, dest)
    pygame.display.flip()

pygame.quit()