This PyQt 4.6.2 program: #-------------- from PyQt4.QtCore import * from PyQt4.QtGui import *
class Btn(QPushButton): def __init__(self, text): super(Btn, self).__init__(text) self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) app = QApplication([]) frm = QFrame() frm.setMinimumSize(400, 300) lay = QVBoxLayout() frm.setLayout(lay) lay.setAlignment(Qt.AlignRight) lay.addWidget(Btn("one")) lay.addWidget(Btn("two two two two two")) frm.show() app.exec_() #-------------- ... produces a window like this: +----------------------------------------------------------+ +---------+ | one | +---------+ +-------------------+ |two two two two two| +-------------------+ +----------------------------------------------------------+ But I *want* to produce a window like this: +----------------------------------------------------------+ +---------+ | one | +---------+ +-------------------+ |two two two two two| +-------------------+ +----------------------------------------------------------+ Can I change this code to make this QVBoxLayout produce the desired result? Note 1: This code change makes no difference in the window: lay.addWidget(Btn("one"), Qt.AlignRight) Note 2: Using this QGridLayout *does* achieve the desired result: lay = QGridLayout() frm.setLayout(lay) lay.addWidget(Btn("one"), 0, 0, Qt.AlignRight) lay.addWidget(Btn("two two two two two"), 1, 0, Qt.AlignRight) Tx, John
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt