Форма создана в QTDesigner, при отрисовке формы только одна кнопка...
Windows 10
python 3.10, PyQT5
Windows 10
python 3.10, PyQT5
Python:
#первый файл!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow
from windowprogram1 import Ui_MainWindow
class MainWindow(QMainWindow, Ui_MainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setupUi(self)
def main_application():
app = QApplication(sys.argv)
main=MainWindow()
main.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main_application()
#второй файл!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\diplom\ui_conv\windowprogram.ui'
#
# Created by: PyQt5 UI code generator 5.15.9
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(804, 774)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(MainWindow)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.InitFilePathSetButton = QtWidgets.QToolButton(MainWindow)
self.InitFilePathSetButton.setObjectName("InitFilePathSetButton")
self.horizontalLayout_3.addWidget(self.InitFilePathSetButton)
self.InintFilePathField = QtWidgets.QTextEdit(MainWindow)
self.InintFilePathField.setObjectName("InintFilePathField")
self.horizontalLayout_3.addWidget(self.InintFilePathField)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.InitDataTable = QtWidgets.QTableWidget(MainWindow)
self.InitDataTable.setObjectName("InitDataTable")
self.InitDataTable.setColumnCount(0)
self.InitDataTable.setRowCount(0)
self.horizontalLayout_2.addWidget(self.InitDataTable)
self.widget = QtWidgets.QWidget(MainWindow)
self.widget.setObjectName("widget")
self.horizontalLayout_2.addWidget(self.widget)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.PlotGraphButton = QtWidgets.QToolButton(MainWindow)
self.PlotGraphButton.setObjectName("PlotGraphButton")
self.horizontalLayout.addWidget(self.PlotGraphButton)
self.LoadDataButton = QtWidgets.QToolButton(MainWindow)
self.LoadDataButton.setObjectName("LoadDataButton")
self.verticalLayout_2.addLayout(self.horizontalLayout)
self.horizontalLayout.addWidget(self.LoadDataButton)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.InitFilePathSetButton.setText(_translate("MainWindow", "1"))
self.LoadDataButton.setText(_translate("MainWindow", "2"))
self.PlotGraphButton.setText(_translate("MainWindow", "3"))
Код:
Вложения
Последнее редактирование: