rgb_10.py

Created by wperez274

Created on August 16, 2023

1.08 KB


from math import *
from cmath import *
from matplotlib.pyplot import *
from turtle import *
from random import *
from random import randint as R
from random import choice as CH

from kandinsky import *
from kandinsky import draw_string as STR
from kandinsky import fill_rect as F
from ion import *
from time import *


M=255


SW=322
SH=222
#could be used as screen border

def box(x,y,w,h,c,line_size):
#left
  fill_rect(x,y,line_size,h,c)
#right  
  fill_rect(x+w-line_size,y,line_size,h,c)
#width
  fill_rect(x,y,w,line_size,c)
#height
  fill_rect(x,y+h-line_size,w,line_size,c)
   


def rgb(c):
  
  
  fill_rect(0,0,322,222,c)
  
  while not keydown(KEY_EXE):
    draw_string(str(c),80,50)
    draw_string("[EXE] = SELECT,EXIT,NAME,PRINT",2,1,(0,255,0),(0,0,0))

    draw_string("[BACKSPACE] = RANDOM COLOR",20,140,(0,255,255),(0,0,0))
    
    
    if keydown(KEY_BACKSPACE):
      sleep(0.15)
      c=(randint(0,255),randint(0,255),randint(0,255))
      fill_rect(0,0,322,222,c)
      
      
  

  sleep(0.5)
  color_name=input("Name: ")
  
  print(color_name,"=",c)
  
  
rgb((0,0,255))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.