我想用文本" X"创建QPushButton。关上窗户。我想把它放在按钮的栏上。为此,我制作了QHLayout。
layTop=QHBoxLayout()
self.btnMenu=QPushButton("Menu") #just as sample of button with normal size
layTop.addWidget(self.btnMenu)
btnX=QPushButton("X") #I need it small
btnX.setSizePolicy(QSizePolicy.Minimum,QSizePolicy.Preferred) #I try this, but it's not work as I expected
layTop.addWidget(btnX)
但是," X"按钮和其他按钮一样大。如何缩小?
(此代码的屏幕截图如下)