PyQt6: TypeError passing alignment kwarg to QLabel constructor

Ales Erjavec ales.erjavec324 at gmail.com
Thu Apr 22 10:44:56 BST 2021


Hi,

`QLabel(alignment=...)` call raises a "TypeError: unable to convert
Python 'AlignmentFlag' object to C++ 'Qt::Alignment' instance":
```
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QLabel, QApplication

app = QApplication([])

w = QLabel(alignment=Qt.AlignmentFlag.AlignLeft)
```
Windows 10
Python: 3.8.8
PyQt6: 6.1.0.dev2104211125

Best wishes
Aleš Erjavec


More information about the PyQt mailing list