PyQt6: TypeError passing alignment kwarg to QLabel constructor

Phil Thompson phil at riverbankcomputing.com
Sun Apr 25 12:07:38 BST 2021


On 22/04/2021 10:44, Ales Erjavec wrote:
> 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

Should be fixed in the next snapshot.

Thanks,
Phil


More information about the PyQt mailing list