Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Random Hex Colors bar generator, python turtle

# Random Hex Colors bar generator, python turtle
from turtle import *
import random
from time import sleep

hideturtle()

n = 0
x = -200
y = 200

while True:
      speed(0)
      pensize(20)
      r = format(random.randint(16, 255), "x")
      g = format(random.randint(16, 255), "x")
      b = format(random.randint(16, 255), "x")
      
      ccode = "#"+r+g+b
      print(ccode)
      
      color(ccode)
      up()
      goto(x, y)
      down()
      
      fd(200)
      
      sleep(1)
      if len(ccode) < 7: continue
      y -= 20
      n += 1
      if n == 20: break
      

Screen().exitonclick()
 
PREVIOUS NEXT
Tagged: #Random #Hex #Colors #bar #python #turtle
ADD COMMENT
Topic
Name
9+1 =