2

I have recently installed PyGame in Python, but something strange happens. When I import it and use it in the terminal, it works fine, but when I try to use it in idle it doesn't work at all. Does someone know why does this happens?

import pygame

pygame.init()

win = pygame.display.set_mode((500, 500))

Exits with the error:

>Traceback (most recent call last):
  File "C:/Users/USER/PycharmProjects/Primer Python/Basico/pygame.py", line 1, in <module>
    import pygame
  File "C:\Users\USER\PycharmProjects\Primer Python\Basico\pygame.py", line 2, in <module>
    pygame.init()
AttributeError: module 'pygame' has no attribute 'init'
Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52

0 Answers0