PYQT5 收集的一些有用的内容

xiaoxiao2021-03-01  44

Layout

按比例布局

    bool QBoxLayout::setStretchFactor(QWidget * widget, int stretch)

    bool QBoxLayout::setStretchFactor(QLayout * layout, int stretch)

vbox.setStretchFactor(self.displayQWidget,5) vbox.setStretchFactor(gird,1)

消息框

result = QMessageBox.question(self, "相位计数", "电机是否转了完整一圈?", QMessageBox.Yes | QMessageBox.No) if result == QMessageBox.Yes: break elif result == QMessageBox.No: self.stopPage3()

字体格式

self.label.setStyleSheet("color:red; background-color:yellow; font-size:25px; font-weight:bold; font-family:Roman times;")#颜色、背景颜色、字体大小,加粗,字体类型
转载请注明原文地址: https://www.6miu.com/read-4550214.html

最新回复(0)