這是介面的語法
mission.py
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(514, 525)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(30, 50, 161, 20))
self.lineEdit.setObjectName("lineEdit")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(310, 50, 75, 23))
self.pushButton.setObjectName("pushButton")
....
這是功能語法
from mission import Ui_MainWindow
class MainWindow_controller(QtWidgets.QMainWindow):
# global positionx,positiony,status
# global counttrip
def __init__(self):
super().__init__() # in python3, super(Class, self).xxx = super().xxx
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.setup_control()
def setup_control(self):
# TODO
# qpushbutton doc: https://doc.qt.io/qt-5/qpushbutton.html
self.ui.pushButton.clicked.connect(self.buttonClicked) #push button to start buttonCliked function
self.ui.pushButton.clicked.connect(self.startThread) #push button to start startThread function
self.ui.pushButton_2.clicked.connect(self.buttonClicked_2)
....
這是我想插入的視窗跟語法
lass Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(262, 335)
self.tableWidget = QtWidgets.QTableWidget(Form)
self.tableWidget.setGeometry(QtCore.QRect(20, 30, 221, 241))
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(2)
self.tableWidget.setRowCount(7)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(5, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setVerticalHeaderItem(6, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setItem(0, 0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setItem(0, 1, item)
item = QtWidgets.QTableWidgetItem()
....
想請問大大一些解答或是提供網站資訊 我再看看學習!!
第一個是我的介面語法
第二個是我介面的功能語法
第三個是我想在原本介面內按下按鈕開啟的視窗
我有點搞混...我應該把連結設在哪兩者才比較正確呢!?
謝謝!!