[Python] Visual Studio code - python- window open the close immediately

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    this is my code my problem is down below, when i run the code

    import pygame as pg
    from OpenGL import *
    from OpenGL.GL import *
    from OpenGL.GLU import *
    from pygame.locals import *

    def Point():
    glBegin(GL_POINTS)
    glVertex3f(0,0,0)
    glEnd()

    def main():
    pg.init()

    display=(800, 600)
    pg.display.set_mode(display, DOUBLEBUF|OPENGL)


    gluPerspective(45, (display[0]/display[1]),0.1, 50.0)
    glTranslatef(0.0, 0.0, -5)


    while True:
    for event in pg.event.get():
    if event.type == pg.QUIT:
    pg.quit()
    return

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    Point()
    pg.display.flip()
    pg.time.wait(10)
    main()


    when i run ,the window open then closes immediately my interepter is python 3.10.11

    Continue reading...

Compartilhe esta Página