lincolnloop / python-qrcode

Python QR Code image generator
https://pypi.python.org/pypi/qrcode
Other
4.39k stars 674 forks source link

Is Image inheritance correct? #293

Closed MaKaNu closed 1 year ago

MaKaNu commented 1 year ago

Version Information

pythob: 3.9 system: windows 10 qrcode: 7.3.1

My Issue

I wanted to use the created qrcode PIL Image to use it in a different package class. Since this class checks for instance of type Image, the created Image of type qrcode.image.pil.PilImage does not match the PIL type Image and the application crashes.

My Workaround

At the moment I use the underscore_attribute image._img, which satisfies the isinstance check against Image. But I want to understand why you create your own version, which is not compatible with a normal Image type?

MaKaNu commented 1 year ago

Maybe I solved it already by figuring out about the get_image method.

SmileyChris commented 1 year ago

Yep, that should be the way you do it.