error

0 Ayush Sahu · October 2, 2015
i get this error: 
Traceback (most recent call last):
  File "C:\Users\gaurav\Desktop\prcticals\py1.pu.py", line 14, in <module>
    if event.type == pygame.QUIT():
TypeError: 'int' object is not callable
while the same bit of code runs perfectly in this video...what might be the possible reasons

Post a Reply

Replies

Oldest  Newest  Rating
0 Ayush Sahu · October 6, 2015
thanks,but it still didint help
now I get this
if pygame.event.type == pygame.QUIT():

AttributeError: 'module' object has no attribute 'type'
:(
0 Vincent Gizzarelli · October 6, 2015
well what you could do is if you are checking for events.
Try something like:
for event in pygame.event.get():
if event.type == QUIT:
quit()
0 Vincent Gizzarelli · October 2, 2015
I think it needs to be: 
if pygame.event.type == pygame.QUIT():
#Do something here


if you don't add the pygame. in front of event.type it's calling something totally different. 
Hope this helps.
  • 1

Python

107,110 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator