Beispiel #1
0
 def save_code_as_image( code , gen ):
     filename = OUTPUT_DIR + "/" + str( gen ) + ".png"
     #surface = pygame.surface.Surface( (IMG_WIDTH, IMG_HEIGHT) , flags = pygame.SRCALPHA )
     Search.window.fill( (0,0,0) )
     code.draw_onto_screen( Search.window )
     
     #draw the generation number
     label = Search.generationFont.render( str( gen ) , 1 , (255,255,255) )
     Search.window.blit( label , (0 , IMG_HEIGHT+1 ) )
     
     #update screen before saving it
     pygame.display.update()
     save_surface( Search.window , filename )
Beispiel #2
0
def main(): 
    codes = Search.search()
    pygame.init()
    screen = pygame.display.set_mode( (32, 32) )
    screen.fill( (0, 0, 0) )
    codes[ 0 ].draw_onto_screen( screen )
    save_surface( screen , OUTPUT_DIR + "/" + "final.bmp" )
    pygame.display.update()
    
    state = 0
    while state == 0:
        pygame.display.update()
        
        for event in pygame.event.get():
            if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
                state = 1
                break
            
        state = 1