1

I was testing pygame with auto_py_to_exe and it came up with this error:

Traceback (most recent call last):
  File "drawrect.py", line 1, in <module>
ModuleNotFoundError: No module named 'pygame'

Image:

Image

Code:

import pygame

Rect = pygame.Rect(0, 0, 150, 150)
Rect.center = (240, 240)
white = (255, 255, 255)
surface = pygame.display.set_mode((480, 480))

pygame.init()

while True:
    surface.fill((0, 0, 0))
    pygame.draw.rect(surface, white, Rect)
    pygame.display.update()

Joyanta J. Mondal
  • 888
  • 1
  • 8
  • 20
SquidR
  • 27
  • 4

1 Answers1

1

pip install pygame is the command you are looking for.

Run this command in your terminal and then try again.

Joyanta J. Mondal
  • 888
  • 1
  • 8
  • 20