Share your repls and programming experiences

← Back to all posts
Rainbow!
Lilliam

Hello there! time to see a rainbow! To do this you need to open a new repl. Then click Pygame if you already used Pygame. You can also type in Pygame if you want. Then write import pygame

pygame.init()
when youur done, you need to choose a background. It should look like this screen = pygame.display.set_mode([800,600])

background_color = (0,102,255)

screen.fill(background_color).
Great! Now we have the color of the sky!
You can also do this if you want a white background, screen = pygame.display.set_mode([800,600])

background_color = (255,255,255)

screen.fill(background_color).
To repeat it you need to use a while True:. Then you need to make the circles so the code should look like this pygame.draw.circle(screen, (255,0,0), (400,400), 350)

pygame.draw.circle(screen, (255,145,0), (400,400), 300)

pygame.draw.circle(screen, (255,255,0), (400,400), 250)

pygame.draw.circle(screen, (0,255,0), (400,400), 200)

pygame.draw.circle(screen, (0,0,255), (400,400), 150)

pygame.draw.circle(screen, (205,0,255), (400,400), 100)

pygame.draw.circle(screen, (0,102,255), (400,400), 50).
You can add a sun if you'd like one and if you do the code should look like this pygame.draw.circle(screen, (255,255,0), (50,50), 50). The next step is to make a rectangle to cover one half of the circle. You should make it green so it's going to represent the grass. It should look like this
pygame.draw.rect(screen,(0,255,0),(0,400,800,400)).
The ending should be like this pygame.display.update()
There! You're all done with the rainbow!
It's a pretty picture! Do you agree with me?

Voters
TK-10PC-708379
Lilliam