Issue
I want to know if it is possible to keep a widget always centred inside a QHBoxLayout.
For Example: I want to make wid1 centred that it won't change its position at all
......wid1......
......wid1..wid2
wid2..wid1......
wid2..wid1..wid3
Solution
please add more information to your question
if you want to center align a label you can use this line:
from PyQt5 import QtCore
self.label.setAlignment(QtCore.Qt.AlignCenter)
Edit:
you are using QHbox which aligns them horizontaly what you want to use is one that aligns them vertically like QVBoxLayout or in a grid like QGridLayout then use the alignment form my previous answer to align it center
hbox.addWidget(Widget, alignment=QtCore.Qt.AlignCenter)
but even if you have other widgets aligned center it would then move a bit to the right or left
Answered By - Ali
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.