Why AttributeError: 'Event' object has no attribute' tpye?

I typed according to the code of the course. Where is the error
import pygame

?

pygame.init ()

< H1 > create a game window < / H1 >

screen = pygame.display.set_mode ((480,700))

< H1 > draw background image < / H1 > < H1 > 1 load image data < / H1 >

bg = pygame.image.load (". / images/background.png")

< H1 > 2blit drawing image < / H1 >

screen.blit (bg, (0,0))

< H1 > draw the hero"s plane < / H1 >

hero = pygame.image.load (". / images/me1.png")

< H1 > screen.blit (hero, (200,500)) < / H1 > < H1 > 3 after all the drawing work is completed, call the update method uniformly < / H1 >

pygame.display.update ()

< H1 > create a clock object < / H1 >

clock = pygame.time.Clock ()

< H1 > 1. Define the rect to record the initial position of the aircraft < / H1 >

hero_rect = pygame.Rect (150,300,102,126)

< H1 > Game cycle < / H1 >

while True:

-sharp 
clock.tick(60)

-sharp 
for event in pygame.event.get():

    -sharp 
    if event.tpye == pygame.QUIT:
        print("")

        -sharp quit
        pygame.quit()

        -sharp exit()
        exit()

-sharp 2.
hero_rect.y -= 1

-sharp 
if hero_rect.y <= 0:
    hero_rect.y = 700

-sharp 3.blit
screen.blit(bg, (0, 0))
screen.blit(hero, hero_rect)

-sharp 4.update
pygame.display.update()
pass

pygame.quit ()

Traceback (most recent call last):
File "C:/Users/Lesley/Desktop/ aircraft Battle / hm_11_ snooping exit event. Py", line 36, in < module >

if event.tpye == pygame.quit:

AttributeError: "Event" object has no attribute" tpye"

Process finished with exit code 1

Jun.17,2022

Hello, check to see if the word is misspelled. The event event has no tpye attribute that should be type

.

clipboard.png

Menu