invalid syntax (<unknown>, line 25) error[Python 3]

Asked 2 years ago, Updated 2 years ago, 20 views

I'm a beginner. I tried to play pygame, but it didn't work, so I tried visual studio, invalid sync (<unknown>, line 25) appears.

"""justwindow.py"""
import sys
import pygame
from pygame.locals import QUIT


pygame.init()
SURFACE = pygame.display.set_mode((400, 300))
pygame.display.set_caption("Just Window")


def main():
    """main routine"""
    while True:
        SURFACE.fill((255, 255, 255))


for event in pygame.event.get():
    if event.type == QUIT:
        pygame.quit()
        sys.exit()
        pygame,display.update()


if__name__=='__main__':
    main()   

This is the source code Why is that?

python

2022-09-21 11:40

1 Answers

In if_name__, place a blank between if and _name__.


2022-09-21 11:40

If you have any answers or tips


© 2025 OneMinuteCode. All rights reserved.