在QtWidgets中进行
1、qt窗口代码
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(401, 318)
self.stackedWidget = QtWidgets.QStackedWidget(Form)
self.stackedWidget.setGeometry(QtCore.QRect(10, 10, 381, 291))
self.stackedWidget.setStyleSheet("")
self.stackedWidget.setFrameShape(QtWidgets.QFrame.Panel)
self.stackedWidget.setObjectName("stackedWidget")
self.retranslateUi(Form)
self.stackedWidget.setCurrentIndex(1)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "zikong"))
2、主程序和绘图类
import sys
from PyQt5.QtGui import *
from zikong import Ui_Form
from PyQt5.Qt import *
class HuiTu(QWidget, Ui_For