janhetjoch
janhetjoch

Reputation: 63

AttributeError: 'Event' object has no attribute 'get'

I am trying to run the following progam in python 2.7.5

import pygame ,sys
pygame.init()
pygame_events = pygame.event.get()
screen = pygame.display.set_mode([640, 480]) 
screen.fill([255,255,255])
pygame.draw.circle(screen, [255, 0, 0],[100, 100], 30 ,0)
pygame.display.flip()
running = True
while running:
    for event in pygame.event.get():
        if event.get == pygame.QUIT:
            running = False
pygame.quit()

However,it does not work and I get the following eror message

Traceback (most recent call last):
File "C:\Python27\tanks\tanks_progam.py", line 10, in <module>
if event.get == pygame.QUIT:
AttributeError: 'Event' object has no attribute 'get'

Can anybody help me with my problem?

Upvotes: 0

Views: 2736

Answers (1)

Jahongir Rahmonov
Jahongir Rahmonov

Reputation: 13763

It should be type not get:

if event.type == pygame.QUIT:

Upvotes: 1

Related Questions