def set_crop_area(self): r = Rect(self.croprect_start, self.croprect_end) # adjust dimensions r.clip_to(self.image_thumb_rect) # ignore rects smaller than this size if min(r.h, r.w) < 10: return ra = r ra = ra.scale_rect(self.scale) ra = ra.move_rect(self.x0, self.y0) ra = ra.valid_rect(self.w, self.h) if self.zoommode: self.canvas.delete(tk.ALL) self.x0 = ra.left self.y0 = ra.top self.region_rect = ra self.displayimage() self.zoommode = False self.zoomButton.deselect() self.zooming = True else: self.drawrect(r) self.crop_rects.append(ra) self.n = self.n + 1 self.set_button_state()