OOP Workshop

Update Screen Click Method

drawing = False
def goto_and_do_whatever_required(x, y):
    global drawing
    if(drawing):
        return

    if(y > 170):        
        if(anyShapeSelected(x,y)):
            updateButtons()
        return
        
    drawing = True
    turtle.color(colors[random.randint(0,len(colors)-1)])
    selectedButton.drawShape(x,y,turtle)
    drawing = False
 
screen.onscreenclick(goto_and_do_whatever_required)

updateButtons()

The goto_and_do_whatever_required method can be altered to handle the screen clicks and address button actions.