I have this bit of python code that imports pygames to draw lines. It auto creates lines when two or more points are clicked on. I'm bad at explaining but you'll see when you run the code. It's pretty simple but I find it kind of fun to mess with and I was wondering if it was possible to have it change colors either through a button or more simply just randomly or just at every five clicks.
This is the code:
##Set up
import pygame,sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((800,500),0,32)
##Drawing lines
color = (100,150,50)
points=[]
##Enabling System Quit
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == MOUSEBUTTONDOWN:
points.append(event.pos)
if len(points)>1:
pygame.draw.lines(screen, color, True, points, 5)
##False means won't auto create line when two or more points
##5 is the width of the line
##Display fix
pygame.display.update()
Thanks a lot if you can help!
Sam.