A few days ago I've started learning pygame. So, now I've got the code which allows me to draw different curves with the help of a mouse. My task is to fill the curve with a color. I know for sure that the curve is close
import pygame as py
import sys
py.init()
White = (255,255,255)
Black = (0,0,0)
clock = py.time.Clock()
H = 400
W = 600
sc = py.display.set_mode((W,H))
sc.fill(White)
py.display.set_caption('Curve drawing')
py.display.update()
draw = False
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
elif i.button == 2:
sc.fill(White)
py.display.update()
elif i.type == py.MOUSEBUTTONUP:
if i.button == 1:
draw = False
if draw == True:
py.draw.circle(sc,Black,i.pos,7)
py.display.update()
Select the correct answer from above options