Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
How to center Align label in PyQt6 (python). How to add margins (fillings) as well
@Amahmoud Docs:
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)
@eyllanesc
The syntax in your reply is incorrect. It is missing an open parenthesis (
label.setAlignment(Qt.AlignmentFlag.AlignCenter)