Python 3/PyGame/maze_3D/Maze_pkg/maze_class.py
def run(self):
        """Create a pygame screen until it is closed."""
        key_to_function = {
            pygame.K_LEFT:   (lambda x: x.move_runner("left")),
            pygame.K_RIGHT:   (lambda x: x.move_runner("right")),
            pygame.K_UP:   (lambda x: x.move_runner("up")),
            pygame.K_DOWN:   (lambda x: x.move_runner("down"))
        }
        done = False
        while not done:
            keys = pygame.key.get_pressed()
            for key in key_to_function.keys():
                if keys[key]:
                    key_to_function[key](self)
            for event in pygame.event.get():
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_ESCAPE:
                        done = True

            pygame.time.delay(100)
            self.display()
            pygame.display.flip()
        pygame.quit()
        return done
Create a pygame screen until it is closed.
Create a pygame screen until it is closed.
Create a pygame screen until it is closed .
def run(self):
        key_to_function = {
            pygame.K_LEFT:   (lambda x: x.move_runner("left")),
            pygame.K_RIGHT:   (lambda x: x.move_runner("right")),
            pygame.K_UP:   (lambda x: x.move_runner("up")),
            pygame.K_DOWN:   (lambda x: x.move_runner("down"))
        }
        done = False
        while not done:
            keys = pygame.key.get_pressed()
            for key in key_to_function.keys():
                if keys[key]:
                    key_to_function[key](self)
            for event in pygame.event.get():
                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_ESCAPE:
                        done = True
            pygame.time.delay(100)
            self.display()
            pygame.display.flip()
        pygame.quit()
        return done
def run ( self ) : key_to_function = { pygame . K_LEFT : ( lambda x : x . move_runner ( "left" ) ) , pygame . K_RIGHT : ( lambda x : x . move_runner ( "right" ) ) , pygame . K_UP : ( lambda x : x . move_runner ( "up" ) ) , pygame . K_DOWN : ( lambda x : x . move_runner ( "down" ) ) } done = False while not done : keys = pygame . key . get_pressed ( ) for key in key_to_function . keys ( ) : if keys [ key ] : key_to_function [ key ] ( self ) for event in pygame . event . get ( ) : if event . type == pygame . KEYDOWN : if event . key == pygame . K_ESCAPE : done = True pygame . time . delay ( 100 ) self . display ( ) pygame . display . flip ( ) pygame . quit ( ) return done
Create a pygame screen until it is closed.
Create a pygame screen until it is closed .
"""Create a pygame screen until it is closed."""
self