from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
self.tabWidget.setGeometry(QtCore.QRect(0, 0, 801, 571))
self.tabWidget.setFont(font)
self.tabWidget.setObjectName("tabWidget")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.checkBox = QtWidgets.QCheckBox(self.tab)
self.checkBox.setGeometry(QtCore.QRect(10, 20, 91, 19))
self.checkBox.setObjectName("checkBox")
self.comboBox = QtWidgets.QComboBox(self.tab)
self.comboBox.setGeometry(QtCore.QRect(10, 60, 87, 22))
self.comboBox.setObjectName("comboBox")
self.dateEdit = QtWidgets.QDateEdit(self.tab)
self.dateEdit.setGeometry(QtCore.QRect(20, 100, 110, 22))
self.dateEdit.setObjectName("dateEdit")
self.dateTimeEdit = QtWidgets.QDateTimeEdit(self.tab)
self.dateTimeEdit.setGeometry(QtCore.QRect(10, 160, 194, 22))
self.dateTimeEdit.setObjectName("dateTimeEdit")
self.tabWidget.addTab(self.tab, "")
self.tab_3 = QtWidgets.QWidget()
self.tab_3.setObjectName("tab_3")
self.dial = QtWidgets.QDial(self.tab_3)
self.dial.setGeometry(QtCore.QRect(50, 80, 50, 64))
self.dial.setObjectName("dial")
self.doubleSpinBox = QtWidgets.QDoubleSpinBox(self.tab_3)
self.doubleSpinBox.setGeometry(QtCore.QRect(40, 190, 70, 22))
self.doubleSpinBox.setObjectName("doubleSpinBox")
self.fontComboBox = QtWidgets.QFontComboBox(self.tab_3)
self.fontComboBox.setGeometry(QtCore.QRect(30, 260, 279, 22))
self.fontComboBox.setObjectName("fontComboBox")
self.lcdNumber = QtWidgets.QLCDNumber(self.tab_3)
self.lcdNumber.setGeometry(QtCore.QRect(40, 310, 64, 23))
self.lcdNumber.setSmallDecimalPoint(True)
self.lcdNumber.setMode(QtWidgets.QLCDNumber.Oct)
self.lcdNumber.setProperty("value", 125.0)
self.lcdNumber.setObjectName("lcdNumber")
self.label = QtWidgets.QLabel(self.tab_3)
self.label.setGeometry(QtCore.QRect(450, 380, 211, 81))
self.label.setObjectName("label")
self.tabWidget.addTab(self.tab_3, "")
self.tab_4 = QtWidgets.QWidget()
self.tab_4.setObjectName("tab_4")
self.lineEdit = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit.setGeometry(QtCore.QRect(40, 50, 113, 21))
self.lineEdit.setObjectName("lineEdit")
self.progressBar = QtWidgets.QProgressBar(self.tab_4)
self.progressBar.setGeometry(QtCore.QRect(40, 180, 118, 23))
self.progressBar.setProperty("value", 50)
self.progressBar.setObjectName("progressBar")
self.pushButton = QtWidgets.QPushButton(self.tab_4)
self.pushButton.setGeometry(QtCore.QRect(40, 260, 93, 28))
self.pushButton.setObjectName("pushButton")
self.radioButton = QtWidgets.QRadioButton(self.tab_4)
self.radioButton.setGeometry(QtCore.QRect(40, 310, 115, 19))
self.radioButton.setObjectName("radioButton")
self.tabWidget.addTab(self.tab_4, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.horizontalSlider = QtWidgets.QSlider(self.tab_2)
self.horizontalSlider.setGeometry(QtCore.QRect(90, 110, 160, 22))
self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
self.horizontalSlider.setObjectName("horizontalSlider")
self.verticalScrollBar = QtWidgets.QScrollBar(self.tab_2)
self.verticalScrollBar.setGeometry(QtCore.QRect(100, 170, 16, 160))
self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical)
self.verticalScrollBar.setObjectName("verticalScrollBar")
self.verticalSlider = QtWidgets.QSlider(self.tab_2)
self.verticalSlider.setGeometry(QtCore.QRect(440, 100, 22, 160))
self.verticalSlider.setOrientation(QtCore.Qt.Vertical)
self.verticalSlider.setObjectName("verticalSlider")
self.spinBox = QtWidgets.QSpinBox(self.tab_2)
self.spinBox.setGeometry(QtCore.QRect(510, 90, 46, 22))
self.spinBox.setObjectName("spinBox")
self.timeEdit = QtWidgets.QTimeEdit(self.tab_2)
self.timeEdit.setGeometry(QtCore.QRect(480, 330, 118, 22))
self.timeEdit.setObjectName("timeEdit")
self.tabWidget.addTab(self.tab_2, "")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(1)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def checkboxshow(self,s):
if s==0:self.label.setPixmap(QtGui.QPixmap(r"C:\Users\komorip\Desktop\daliy\python\uidesign\iconn\q11.jpg"))
self.label.setText(str(s))
def comboxshow_index(self,i):
def comboxshow_text(self,s):
self.label.setText(str(b*s))
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.checkBox.setText(_translate("MainWindow", "你是猪"))
self.checkBox.setCheckState(Qt.Checked)
self.checkBox.stateChanged.connect(self.checkboxshow)
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", " 1"))
self.label.setScaledContents(True)
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "2"))
self.pushButton.setText(_translate("MainWindow", "PushButton"))
self.radioButton.setText(_translate("MainWindow", "RadioButton"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("MainWindow", "3"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "4"))
self.comboBox.addItems(["1","2","3","4","5"])
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui.comboBox.currentTextChanged.connect(ui.comboxshow_text)
ui.pushButton.clicked.connect(lambda:ui.compute(3,q))