[Python] Simple problem with pygame that I can't figure out

Discussão em 'Python' iniciado por Stack, Maio 30, 2025.

  1. Stack

    Stack Membro Participativo

    So, I made this very simple code and I need help to know why it doesn't work. Here is the code:

    import pygame as py
    from pygame import Vector2
    scr = py.display.set_mode((800,400))
    def test():
    scr1 = py.display.get_surface()
    sur = py.surface.Surface((0,0))
    scr1.blit(sur,(400,200))
    sur.fill((255,255,255))
    while True:
    for event in py.event.get():
    if event.type == py.QUIT:
    py.quit()
    exit()
    scr.fill((0,0,0))
    test()
    py.display.update()



    So, I tried pulling everything that is inside the function to outside of it, but that didn't work as well, I expected a white square in the middle of the screen, but is just pure black. Can anybody help me?

    Continue reading...

Compartilhe esta Página