maybe program ends and it closes window. Do you get any error message ? Did you try to add at least time.sleep(1) or use endless loop while True ? Or maybe on some systems it will not open window if you don't use pygame.events.get(). What system do you use Window/Mac/Linux ?
The problem here is that the program ends and closes the window. You should create some sort of game loop to keep the window open. An easy fix is to use an infinite while loop after the last line.
import pygame
pygame.init()
win = pygame.display.set_mode((500,500))
while True:
pass
time.sleep(1)or use endless loopwhile True? Or maybe on some systems it will not open window if you don't usepygame.events.get(). What system do you use Window/Mac/Linux ?