OOP Workshop
Red Button Boundary
Displaying a red boundary for selected color button as well:
Modify the
if(self is selectedButton):
aTurtle.color("Red")
part of the drawTheButton method of the Button class as
if(self is selectedButton or self is selectedColorButton):
aTurtle.color("Red")
Modify the main flow:
drawing = False
def goto_and_do_whatever_required(x, y):
global drawing
if(drawing):
return
drawing = True
if(y > 170):
if(anyShapeSelected(x,y)):
updateButtons()
if(anyColorSelected(x,y)):
updateColorButtons()
drawing = False
return
turtle.color(selectedColorButton.getColor())
selectedButton.drawShape(x,y,turtle)
drawing = False
screen.onscreenclick(goto_and_do_whatever_required)
updateButtons()
updateColorButtons()