Skip to content

Commit

Permalink
Resolved Bug - Color change of BBox on Editing
Browse files Browse the repository at this point in the history
  • Loading branch information
virajmavani committed Jul 9, 2018
1 parent 0ff294c commit 7ad14ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __init__(self, master):
self.bboxId = None
self.currLabel = None
self.editbboxId = None
self.currBboxColor = None
self.zoomImgId = None
self.zoomImg = None
self.zoomImgCrop = None
Expand Down Expand Up @@ -269,6 +270,7 @@ def mouse_click(self, event):
def mouse_drag(self, event):
self.mouse_move(event)
if self.bboxId:
self.currBboxColor = self.canvas.itemcget(self.bboxId, "outline")
self.canvas.delete(self.bboxId)
self.canvas.delete(self.o1)
self.canvas.delete(self.o2)
Expand All @@ -278,12 +280,13 @@ def mouse_drag(self, event):
self.bboxId = self.canvas.create_rectangle(self.STATE['x'], self.STATE['y'],
event.x, event.y,
width=2,
outline=config.COLORS[(len(self.bboxList) - 1) % len(config.COLORS)])
outline=self.currBboxColor)
else:
self.currBboxColor = config.COLORS[len(self.bboxList) % len(config.COLORS)]
self.bboxId = self.canvas.create_rectangle(self.STATE['x'], self.STATE['y'],
event.x, event.y,
width=2,
outline=config.COLORS[len(self.bboxList) % len(config.COLORS)])
outline=self.currBboxColor)

def mouse_move(self, event):
self.disp.config(text='x: %d, y: %d' % (event.x, event.y))
Expand Down Expand Up @@ -324,7 +327,7 @@ def mouse_release(self, event):
self.objectLabelList.append(str(self.currLabel))
self.objectListBox.insert(END, '(%d, %d) -> (%d, %d)' % (x1, y1, x2, y2) + ': ' + str(self.currLabel))
self.objectListBox.itemconfig(len(self.bboxIdList) - 1,
fg=config.COLORS[(len(self.bboxIdList) - 1) % len(config.COLORS)])
fg=self.currBboxColor)
self.currLabel = None

def zoom_view(self, event):
Expand Down

0 comments on commit 7ad14ed

Please sign in to comment.