pyQT5实现窗体之间传值的示例-创新互联
准备
我们提供的服务有:成都网站建设、网站建设、微信公众号开发、网站优化、网站认证、怀远ssl等。为数千家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的怀远网站制作公司一个MainWindow和一个WidgetForm,总代码如下
# -*- coding: utf-8 -*- from PyQt5 import QtWidgets from main_windows import Ui_MainWindow import sys from wid_defs import my_widgets from dlg_defs import my_Dialog class MyWindow(QtWidgets.QMainWindow,Ui_MainWindow): def __init__(self): super(MyWindow,self).__init__() self.setupUi(self) def openDialog(self): self.dlg = my_Dialog() www = self.textEdit.toPlainText() self.dlg.setT(www) self.dlg.exec_() def openWidget(self): self.wid = my_widgets() self.wid.pushButton.clicked.connect(self.GetText) www= self.textEdit.toPlainText() self.wid.setT(www) self.wid.show() #close wid form def GetText(self): self.textEdit.setText(self.wid.textEdit.toPlainText()) self.wid.close() if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) mainWindow = MyWindow() mainWindow.show() sys.exit(app.exec_())
新闻标题:pyQT5实现窗体之间传值的示例-创新互联
URL地址:http://scyanting.com/article/dichpp.html