Center Align in PyQt6 (python)
-
wrote on 24 Sept 2021, 17:24 last edited by
How to center Align label in PyQt6 (python). How to add margins (fillings) as well
-
wrote on 24 Sept 2021, 20:50 last edited by
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) -
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)wrote on 24 Sept 2021, 20:57 last edited by@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)
-
@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)
wrote on 30 Mar 2022, 19:57 last edited byThe syntax in your reply is incorrect. It is missing an open parenthesis (
label.setAlignment(Qt.AlignmentFlag.AlignCenter)