Currently I have a zoom feature in my application that works very well, however I'd like the actual zoom box to be a circle instead. Here's what the current zoom looks like:
the zoomed in rectangle is where the mouse pointer location is, and surrounding area is zoomed in. But how can I make this zoomed object a circle as opposed to a square? Here's my code:
def zoom(self, event):
if(event.delta > 0):
if self.zoomValue != 4 : self.zoomValue += 1
elif(event.delta < 0):
if self.zoomValue != 0 : self.zoomValue -= 1
self.crop(event)
def crop(self, event):
if self.zimg_id: self.canvasLower.delete(self.zimg_id)
if (self.zoomValue) != 0:
x, y = event.x, event.y
if self.zoomValue == 1:
tmp = self.orig_img.crop((x-45, y-30, x+45, y+30))
elif self.zoomValue == 2:
tmp = self.orig_img.crop((x-30, y-20, x+30, y+20))
elif self.zoomValue == 3:
tmp = self.orig_img.crop((x-15, y-10, x+15, y+10))
elif self.zoomValue == 4:
tmp = self.orig_img.crop((x-6, y-4, x+6, y+4))
size = 200, 200
# crop tmp somehow to make the image a circle? maybe?
self.zimg = ImageTk.PhotoImage(tmp.resize(size))
self.zimg_id = self.canvasLower.create_image(event.x, event.y, image=self.zimg)