pythonpgzero

I wrote a line to display hello in pygamezero but instead its showing white blocks instead of texts


i executed the following code

def draw():
    screen.draw.text("hello", topleft=(10 , 10))

but the output I get is just 5 white blocks instead of hello enter image description here


Solution

  • The minimal Pygame Zero script looks as follows:

    import pgzrun
    
    def draw():
        screen.clear()
        screen.draw.text("hello", topleft = (10, 10))
    
    pgzrun.go()
    

    You have to call pgzrun.go() after the definition of the draw function.