You could use the PyGame polygon drawing function to create a filled area bounded by all the mouse points.
So instead of drawing the circle at each point, keep adding a mouse position to the list of co-ordinates as a mouse moves. When a button is released, draw the filled polygon around all these points.
fill_coords = [] # points to make filled polygon
while 1:
for i in py.event.get():
if i.type == py.QUIT:
py.image.save(sc,r'C:/Users/Xiaomi' + '/temporary.png')
py.quit()
sys.exit()
elif i.type == py.MOUSEBUTTONDOWN:
if i.button == 1:
draw = True
fill_coords = [] # restart the polygon
elif i.button == 2:
sc.fill(White)
py.display.update()
elif i.type == py.MOUSEBUTTONUP:
if i.button == 1:
draw = False
pygame.draw.polygon( sc, Black, fill_coords ) # filled polygon
elif i.type == pygame.MOUSEMOTION: # when the mouse moves
if ( draw ):
fill_coords.append( i.pos ) # remember co-ordinate
mouse_position = pygame.mouse.get_pos()
if draw == True:
py.draw.circle(sc,Black,i.pos,7)
py.display.update()
If you are a beginner and want to know more about Python the do check out the Data Science with Python Course