self.containing_canvas = parent self.coordinates = coordinates self.elements = {} self.tmp = {} self.cs_element = cs_element self.as_element = as_element self.diff_results = {} for f in self.elements: self.containing_canvas.delete(f) # Code adapted from: https://stackoverflow.com/questions/9576063/stacking-order-maintenance-in-tkinter layer_tag = "layer %s" % layer if layer_tag not in self.containing_canvas.layers: self.containing_canvas.layers.append(layer_tag) self.containing_canvas.itemconfigure(ID, tags=[layer_tag]) for layer in sorted(self.containing_canvas.layers): self.containing_canvas.lift(layer) for f in self.elements: old_coords = self.containing_canvas.coords(f) new_x = new_location[0] + self.elements[f]['x'] new_y = new_location[1] + self.elements[f]['y'] if len(old_coords) == 2: self.containing_canvas.coords(f, (new_x, new_y)) elif len(old_coords) == 4: height = old_coords[3] - old_coords[1] width = old_coords[2] - old_coords[0] self.containing_canvas.coords(f, (new_x, new_y, new_x + width, new_y + height))