Random Color Rectangle Drawing with Arcade

  • Share this:

Code introduction


This function uses the Arcade library to draw a rectangle with a random color.


Technology Stack : Arcade

Code Type : Function

Code Difficulty : Intermediate


                
                    
import arcade
import random

def random_color_rectangle(x, y, width, height):
    # Generate a random color
    color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
    # Draw a rectangle with the random color
    arcade.draw_rectangle_filled(x, y, width, height, color)

# Code Information                
              
Tags: