In this article we will see how we can draw circles on window in PYGLET module in python. Pyglet is easy to use but powerful library for developing visually rich GUI applications like games, multimedia etc. A window is a “heavyweight” object occupying operating system resources. Windows may appear as floating regions or can be set to fill an entire screen (fullscreen). A circle is a shape consisting of all points in a plane that are a given distance from a given point, the centre; equivalently it is the curve traced out by a point that moves in a plane so that its distance from a given point is constant. Circle is drawn with the help of shapes module in pyglet.
We can create a window with the help of command given below
# creating a window window = pyglet.window.Window(width, height, title)
In order to create window we use
Circlemethod with pyglet.shapes
Syntax : shapes.Circle(x, y, size, color)
Argument : It takes first two integer i.e circle position, third integer as size of circle and forth is tuple i.e color of circle as argument
Return : It returns Circle object
Below is the implementation
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.