コード例 #1
0
def make_lithuanian_flag(width):
    height = width * 3 // 5
    flag = PPMImage(width, height)
    for i in range(width):
        for j in range(height):
            if j < height // 3:
                flag[i, j] = 253, 185, 19
            elif j < 2 * width // 3:
                flag[i, j] = 0, 106, 68
            else:
                flag[i, j] = 193, 39, 45
    flag.writeToFile("Lithuania.ppm")
コード例 #2
0
def make_french_flag(width):
	
    height = width * 2 // 3
    flag = PPMImage(width, height)
    for i in range(height):
        for j in range(width):
            if j < width //3:
                flag[i, j] = 0, 85, 164
            elif j < 2*width//3:
                flag[i, j] = 255, 255, 255
            else:
                flag[i, j] = 250, 60, 50
    flag.writeToFile("france.ppm")
コード例 #3
0
def make_german_flag(width):
    
    height = width * 3 // 5
    
    flag = PPMImage(width, height)
    for i in range(width):
        for j in range(height):
            if j < height // 3:
                flag[i, j] = 0, 0, 0
            elif j < 2 * width // 3:
                flag[i, j] = 255, 0, 0
            else:
                flag[i, j] = 255, 230, 0
    flag.writeToFile("Germany.ppm")