0

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?

1 Answer 1

1

It should be type not get:

if event.type == pygame.QUIT:
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.