Rainbow Flag in Pygame

This little Pygame program paints the Rainbow Flag, as used by the LGBT movement. It illustrates:

'''     RainbowFlag.py
        Author: Alan Richmond, Python3.codes
        https://en.wikipedia.org/wiki/Rainbow_flag_(LGBT_movement)
'''
import pygame
cols = ['#ff0000','#ff8000','#ffff00','#008000','#0000ff','#a000c0']

w, h = 1000, 618                    # width, height
y = h/6                             # width per stripe

d = pygame.display.set_mode((w,h))
for i, c in enumerate(cols):
    d.fill(pygame.Color(c),rect=(0,i*y,w,y*(i+1)))

pygame.display.flip()
pygame.image.save(d,'RainbowFlag.png')

[welcomewikilite wikiurl=”https://en.wikipedia.org/wiki/Rainbow_flag_(LGBT_movement)” sections=”Short description” settings=””]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.