Pyglet Circle Drawing with Random Color

  • Share this:

Code introduction


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)                
              
Tags: