import pygame
from pygame.locals import *
from sys import exit
from random import *

pygame.init()

screen = pygame.display.set_mode((640, 480), 0, 32)

while True:
    
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
            
    random_color = (randint(0, 255), randint(0, 255), randint(0, 255))
    random_pos = (randint(0, 639), randint(0, 479))
    random_radius = randint(1,200)
    
    pygame.draw.circle(screen, random_color, random_pos, random_radius)
    
    pygame.display.update()

I lookup the the pygame circle function and found it needed five arguments, not four a listed here. And how am I to know of what data type these arguments should be? There is the pygame circle function.

def circle():
  """ pygame.draw.circle(Surface, color, pos, radius, width=0): return Rect
  draw a circle around a point """
  pass

width is optional as it has default value of 0 for width (then the circle is filled with only 4 arguments)

pygame.draw.circle

draw a circle around a point
pygame.draw.circle(Surface, color, pos, radius, width=0): return Rect

Draws a circular shape on the Surface. The pos argument is the center of the circle, and radius is the size. The width argument is the thickness to draw the outer edge. If width is zero then the circle will be filled.

The explanation is for all draw functions in the documentation:

Draw several simple shapes to a Surface. These functions will work for rendering to any format of Surface. Rendering to hardware Surfaces will be slower than regular software Surfaces.

Most of the functions take a width argument to represent the size of stroke around the edge of the shape. If a width of 0 is passed the function will actually solid fill the entire shape.

All the drawing functions respect the clip area for the Surface, and will be constrained to that area. The functions return a rectangle representing the bounding area of changed pixels.

Most of the arguments accept a color argument that is an RGB triplet. These can also accept an RGBA quadruplet. The alpha value will be written directly into the Surface if it contains pixel alphas, but the draw function will not draw transparently. The color argument can also be an integer pixel value that is already mapped to the Surface's pixel format.

These functions must temporarily lock the Surface they are operating on. Many sequential drawing calls can be sped up by locking and unlocking the Surface object around the draw calls.

The creators of the pygame module expect its users to be somewhat familiar with the basics of Python.

The creators of the pygame module expect its users to be somewhat familiar with the basics of Python.

I thought I was. Perhaps I have jumped the gun with pygame.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.