TypeError: Required argument 'dest' (pos 2) not found

Lilly M.

I'm trying to make a shooter game with pygame, but when I run my game, it displays the pygame window, but gives an error:

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

Here's my code:

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))
SCREEN.blit(text, dest)
is_running = True
while is_running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_running = False
            pygame.quit()

Hopefully, you can help.

eyllanesc

You must define the dest variable. You should also call the function pygame.display.flip(). For example:

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

Screenshot:

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TypeError: Required argument 'outImg' (pos 6) not found

Python TypeError: Required argument 'offset' (pos 1) not found

hexdigest() throws TypeError: Required argument 'length' (pos 1) not found

Required argument 'rejectLevels' (pos 2) not found OpenCV Raspberry Pi

Python TypeError: UMat() missing required argument 'ranges' (pos 2)

Python: TypeError: Required argument 'sequence' (pos 1) not found on outputing datetime tuple

OpenCV python canny Required argument 'threshold2' (pos 4) not found

Django python: Using DateInput --Required argument 'year' (pos 1) not found

TypeError: open() missing required argument 'file' (pos 1)

TypeError: destroyWindow() missing required argument 'winname' (pos 1)

TypeError: Required argument not found __getitem__ numpy

Got "function missing required argument 'month' (pos 2)" error while adding a DateField to models.py

Error - function missing required argument 'month' (pos 2), is displayed when trying to fetch time in fixed format

The argument "ami" is required, but no definition was found

TypeError: str() takes at most 1 argument (2 given) and TypeError: an integer is required

required_no_argument found string string string

The argument "plan_product" is required, but no definition was found

TypeError: post() missing 1 required positional argument

TypeError: Missing 1 required positional argument: 'self'

TypeError: missing 1 required positional argument (LinkedList)

TypeError: <lambda>() missing 1 required positional argument:

TypeError: The "digest" argument is required and must not be undefined

TypeError: method missing required positional argument

TypeError: Missing one required positional argument

Pygame - TypeError: Missing 1 required positional argument

TypeError: fuction missing 1 required positional argument

TypeError: <lambda>() missing 1 required positional argument

TypeError <lambda> missing 1 required positonal argument

TypeError: __init__() missing 1 required positional argument: 'on_delete' (Django 2)