#NEWLINE# def fill_pix( self , point , old_colour , colour ) : #NEWLINE# #INDENT# '\n        Pixel flood-fill. Reliable, but slow.\n        ' #NEWLINE# to_fill = [ point ] #NEWLINE# while to_fill : #NEWLINE# #INDENT# ( x , y ) = to_fill . pop ( ) #NEWLINE# self . set_pixel ( x , y , colour ) #NEWLINE# for ( nx , ny ) in [ ( ( x - 1 ) , y ) , ( ( x + 1 ) , y ) , ( x , ( y - 1 ) ) , ( x , ( y + 1 ) ) ] : #NEWLINE# #INDENT# if ( ( 0 <= to_fill < self . size [ 0 ] ) and ( 0 <= ny < self . size [ 1 ] ) ) : #NEWLINE# #INDENT# if ( self . pixels [ ny ] [ nx ] == old_colour ) : #NEWLINE# #INDENT# to_fill . append ( ( nx , ny ) )