Python 3/PyGame/representations_with_matrixes/repr2d.py
def run(self):
        """Create a pygame screen until it is closed."""
        # key_to_function = {
        #     pygame.K_LEFT:   (lambda x: x.rotateAll('Y', -0.1)),
        #     pygame.K_RIGHT:   (lambda x: x.rotateAll('Y', 0.1)),
        #     pygame.K_UP:   (lambda x: x.rotateAll('X', -0.1)),
        #     pygame.K_DOWN:   (lambda x: x.rotateAll('X', 0.1)),
        #     pygame.K_q:   (lambda x: x.rotateAll('Z', -0.1)),
        #     pygame.K_e:   (lambda x: x.rotateAll('Z', 0.1)),
        #     pygame.K_d:  (lambda x: x.move_all('x',  10)),
        #     pygame.K_a:   (lambda x: x.move_all('x', -10)),
        #     pygame.K_s:   (lambda x: x.move_all('y',  10)),
        #     pygame.K_w:     (lambda x: x.move_all('y', -10)),
        #     pygame.K_LSHIFT: (lambda x: x.scaleAll(1.25)),
        #     pygame.K_LCTRL:  (lambda x: x.scaleAll( 0.8))
        # }
        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()
        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):
        done = False
        while not done:
            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()
        return done
def run ( self ) : done = False while not done : 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 ( ) 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.""" # key_to_function = { #     pygame.K_LEFT:   (lambda x: x.rotateAll('Y', -0.1)), #     pygame.K_RIGHT:   (lambda x: x.rotateAll('Y', 0.1)), #     pygame.K_UP:   (lambda x: x.rotateAll('X', -0.1)), #     pygame.K_DOWN:   (lambda x: x.rotateAll('X', 0.1)), #     pygame.K_q:   (lambda x: x.rotateAll('Z', -0.1)), #     pygame.K_e:   (lambda x: x.rotateAll('Z', 0.1)), #     pygame.K_d:  (lambda x: x.move_all('x',  10)), #     pygame.K_a:   (lambda x: x.move_all('x', -10)), #     pygame.K_s:   (lambda x: x.move_all('y',  10)), #     pygame.K_w:     (lambda x: x.move_all('y', -10)), #     pygame.K_LSHIFT: (lambda x: x.scaleAll(1.25)), #     pygame.K_LCTRL:  (lambda x: x.scaleAll( 0.8)) # } # keys = pygame.key.get_pressed() # for key in key_to_function.keys(): #     if keys[key]: #         key_to_function[key](self)
self