ハイ、
すっごく、私は QTDesigner で MainWindow.ui ファイルを作成しました。次に、次のコマンドを使用してこの gui を .py ファイルにインポートします。
form_class = uic.loadUiType("ess_project.ui")[0]
この .ui ファイルを pyuic4 でコンパイルした場合の違いは何ですか? (.uiファイルをコンパイルするたびに、次のエラーが発生しました:
RuntimeError: the sip module implements API v11.0 to v11.1 but the PyQt4.QtCore module requires API v10.1
MainWindow は、すべてのボタンなどが配置される最初のウィンドウを作成します。
class MainWindow(QtGui.QMainWindow, form_class):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
PlotWindow.__init__(self)
self.setupUi(self)
self.pb_send.clicked.connect(self.pb_send_clicked)
self.pb_open.clicked.connect(self.pb_open_clicked)
self.pb_exit.clicked.connect(self.pb_exit_clicked)
self.comboBox.currentIndexChanged.connect(self.combo_box_changed)
さらに、「PlotWindow」という名前の 2 番目のクラスがあります。このクラスは次のようになります。
class PlotWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.w = QtGui.QMainWindow()
self.cw = pg.GraphicsLayoutWidget()
self.w.show()
self.w.resize(900,600)
self.w.setCentralWidget(self.cw)
self.w.setWindowTitle('pyqtgraph: G-CODE')
self.p = self.cw.addPlot(row=0, col=0)
ご覧のとおり、PloWindow クラスは 2 つ目の Window を作成します。
pg.GraphicsLayoutWidget() を MainWindow - クラスに実装するにはどうすればよいですか??
これがあなたを助けることができるかどうかわからない?!? :
def main():
app = QtGui.QApplication([])
myWindow = MainWindow(None)
myWindow.show()
app.exec_()
if __name__ == '__main__':
main()
私はpython3を使用しています!!! お気軽にコメントしてください:)ありがとう!