You can download this code by clicking the button below.
This code is now available for download.
This function uses the draw_circle method from the Pyglet library to draw a circle with a random color on the window.
Technology Stack : Pyglet
Code Type : Graphics drawing
Code Difficulty : Intermediate
import random
def draw_random_circle(window, x, y, radius):
color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
window.draw_circle(x, y, radius, color=color)