简体   繁体   中英

module pygame has no member QUIT?

simple code but still not able to figure out where things are going wrong, it says module pygame has no member QUIT,quit

import pygame
WIDTH = 900
HEIGHT = 500
WIN = pygame.display.set_mode((WIDTH, HEIGHT))


def main():
    run = True
    while run:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run=False
    
    pygame.quit()


if __name__=="__main__":
    main()

Since you already imported pygame you can just do "QUIT" instead of "pygame.QUIT"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM