i am trying to make a circular view/widget like we have for our pics in the forum. I think I am going about it the right way. I am using a custom ui.View class and overriding the draw method.
I can make a white circle that is clipped...Yeah 🎉🎉🎉
Not what I need though. I need to be able to invert my clipping so I get a keyhole effect. The idea is that this view would be placed on top of a image view, just showing the circular cut out of the image beneath.
I think the answer lies with the append_path method. For some reason, I can think through it. Any help appreciated.
import ui
class CircularView(ui.View):
def __init__(self):
pass
def draw(self):
oval = ui.Path.oval(0,0, self.width, self.height)
rect = ui.Path.rect(0,0, self.width, self.height)
#rect.append_path(oval)
ui.Path.add_clip(oval)
ui.set_color('white')
oval.fill()
if __name__ == '__main__':
cv = CircularView()
cv.present('sheet')
