class Sugar: def __init__(self, turtle_window, id_number): # comment here self.turtle_window = turtle_window self.id_number = id_number self.name = 'Sugar' # comment here self.turtle_object = RawTurtle(self.turtle_window.wn) self.turtle_object.hideturtle() self.turtle_object.shape('square') self.turtle_object.penup() self.turtle_object.color("black", "white") self.place() self.turtle_object.showturtle() # comment here self.turtle_object.ondrag(self.drag) def place(self): # comment here self.turtle_object.goto(random.randint(-MAX_LOCATION, MAX_LOCATION), random.randint(-MAX_LOCATION, MAX_LOCATION)) def drag(self, x, y): # comment here self.turtle_object.goto(x, y) self.turtle_window.wn.update()
class HeatSource: ############################################################################################################### def __init__(self, turtle_window, id_number): self.turtle_window = turtle_window self.id_number = id_number self.heat_source = RawTurtle(self.turtle_window.wn) self.heat_source.hideturtle() self.heat_source.shape('circle') self.heat_source.penup() self.heat_source.color("orange") self.place() self.heat_source.showturtle() self.heat_source.ondrag(self.drag_heat_source) def place(self): max_location = self.turtle_window.screen_size / 2 - 10 self.heat_source.goto(random.randint(-max_location, max_location), random.randint(-max_location, max_location)) def drag_heat_source(self, x, y): self.heat_source.goto(x, y) self.turtle_window.wn.update()