这里三个按钮的大小是相等的,如何增加只有第一个按钮的大小,使其比其他两个按钮占用更多的空间。
from PyQt4 import QtGui
import sys
class AllWidgets(QtGui.QWidget):
def __init__(self):
super(AllWidgets, self).__init__()
layout = QtGui.QHBoxLayout()
#code for pushbutton 1
pushbutton_1 = QtGui.QPushButton()
pushbutton_1.setText('First')
layout.addWidget(pushbutton_1)
#code for pushbutton 2
pushbutton_2 = QtGui.QPushButton()
pushbutton_2.setText('Second')
layout.addWidget(pushbutton_2)
#code for pushbutton 3
pushbutton_3 = QtGui.QPushButton()
pushbutton_3.setText('Third')
layout.addWidget(pushbutton_3)
self.setLayout(layout)
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
display = AllWidgets()
display.show()
sys.exit(app.exec_())