I’m trying to make an online game using Django, but having some trouble:
Here is my game code in py/main.py
import pygame
import sys
def main():
pygame.init()
screen = pygame.display.set_mode((50, 50))
pygame.display.set_caption("Test")
while True:
screen.fill((255, 255, 255))
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
When I run server, it said ” no module name ‘pygame’ ”
After that, i tried to “py -m pip install pygame” but it said: already have
enter image description here
Then how can I import pygame in Django?
New contributor
montey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.