I followed a snake game tutorial but for some reason I can't get the QUIT to match:
class Game:
    ...
    def handle_keys(self):
        for event in pg.event.get():
            pressed = pg.key.get_pressed()
            if event.type == QUIT or pressed[QUIT]:
                pg.quit()
                sys.exit()
            elif event.type == pg.KEYDOWN:
                if pressed[pg.K_UP]:
                    self.snake.turn(self.UP)
                elif pressed[pg.K_DOWN]:
                    self.snake.turn(self.DOWN)
                elif pressed[pg.K_LEFT]:
                    self.snake.turn(self.LEFT)
                elif pressed[pg.K_RIGHT]:
                    self.snake.turn(self.RIGHT)
    def run(self):
        while True:
            self.clock.tick(10)
            self.handle_keys()
The snake moves fine but the QUIT button doesn't seem to be working no matter which method I try or even a combination of both as shown above. I'm on the latest Ubuntu 20.04 version not sure if that makes a difference. I noticed the values for event.TYPE and pressed[QUIT] are completely different from pg.QUIT and pg.locals.QUIT. This is my first attempt at pygame as well just not sure why not getting the same output as the guide I'm following.
EDIT:
None of the solutions I find online are working nor the ones "related" or "suggested" below. I'm just going to switch to Unity3D after struggling with this for over a week now.
 
     
    