Typehint issues with qr code and color

5 views
Skip to first unread message

MaKaNufilms

unread,
May 15, 2026, 4:44:56 AM (4 days ago) May 15
to reportlab-users
I discovered two small type hinting issues in python library:

from reportlab.lib.units import mm
from reportlab.graphics.barcode.qr import QrCodeWidget

qr = QrCodeWidget("Test")
qr.x = 1 * mm

This creates:

Cannot assign to attribute "x" for class "QrCodeWidget"
     "float" is not assignable to "int"

I would assume that float for a coordinate value is fine and should be accepted.
The same goes for qr.y.

from reportlab.lib import colors
from reportlab.graphics.shapes import Rect

rect = Rect(
    0, 0, 20, 20,
    fillColor=colors.transparent,
    strokeColor=colors.red
)

This results in:

Argument of type "Color" cannot be assigned to parameter "fillColor" of type "_SolidShapeKwArgs" in function "__init__"
     "Color" is not assignable to "_SolidShapeKwArgs"

For both color entries.

The code works perfectly fine, just the types are incorrect.
Reply all
Reply to author
Forward
0 new messages