Skip to main content
typo correction
Source Link
Juanpa
  • 292
  • 4
  • 9

You should do if-elif-elif with e.type. First import the event contansconstants you need to check from pygame.constants For example

from pygame.constants import QUIT, MOUSEBUTTONDOWN
while true:
    for e in pygame.event.get():
        if e.type == QUIT:
            #close the game
        elif e.type == MOUSEBUTTONDOWN:
            #mouse click

The dir() function gives the directory where a module is located, that doesn't work as you think

You should do if-elif-elif with e.type. First import the event contans you need to check from pygame.constants For example

from pygame.constants import QUIT, MOUSEBUTTONDOWN
while true:
    for e in pygame.event.get():
        if e.type == QUIT:
            #close the game
        elif e.type == MOUSEBUTTONDOWN:
            #mouse click

The dir() function gives the directory where a module is located, that doesn't work as you think

You should do if-elif-elif with e.type. First import the event constants you need to check from pygame.constants For example

from pygame.constants import QUIT, MOUSEBUTTONDOWN
while true:
    for e in pygame.event.get():
        if e.type == QUIT:
            #close the game
        elif e.type == MOUSEBUTTONDOWN:
            #mouse click

The dir() function gives the directory where a module is located, that doesn't work as you think

Source Link
Juanpa
  • 292
  • 4
  • 9

You should do if-elif-elif with e.type. First import the event contans you need to check from pygame.constants For example

from pygame.constants import QUIT, MOUSEBUTTONDOWN
while true:
    for e in pygame.event.get():
        if e.type == QUIT:
            #close the game
        elif e.type == MOUSEBUTTONDOWN:
            #mouse click

The dir() function gives the directory where a module is located, that doesn't work as you think