Center Align in PyQt6 (python)
Moved
Unsolved
Qt for Python
-
-
I am using python. I have tried several ones. I dont think I understand well so check what i have tried
self.label.setAlignment(AlignCenter)
self.label.setAlignment(Qt.AlignCenter)
self.txtbx1.setAlignment(QtCore.Qt.AlignCenter) -
@Amahmoud said in Center Align in PyQt6 (python):
AlignCenter
PyQt6 is more demanding so you must point out the enumeration:
from PyQt6.QtCore import Qt label.setAlignmentQt.AlignmentFlag.AlignCenter)
The syntax in your reply is incorrect. It is missing an open parenthesis (
label.setAlignment(Qt.AlignmentFlag.AlignCenter)