Leah9 / screengrab

2 stars 1 forks source link

Get box does not alter the captured area #16

Closed Leah9 closed 2 years ago

Leah9 commented 2 years ago

The below works

update the values in the object

    self.x1, self.y1 = x1y1
    self.x2, self.y2 = x2y2
    print(self.region())
    messagebox.showinfo(title="Finished", message=f"Captured area was {self.region()}", parent=self)
ArielMAJ commented 2 years ago

I just took a look here and realized that the code was saving the box to self.box but using self.region to capture the image. self.box was updated but self.region never was, that's why it didn't change the captured region. As self.box wasn't used, it was a good call to remove it altogether.

Btw when we use the property decorator (@property) we can treat it as a variable instead of function (but it will work like a function).