|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
这样字按钮点开后就会崩溃 函数不能导入
y1.py
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import sys
- from PyQt5.QtWidgets import QWidget,QApplication,QTextEdit,QVBoxLayout,QLabel
- from PyQt5.QtGui import QDragEnterEvent,QPixmap
- import os
- from PyQt5 import QtCore, QtGui, QtWidgets
- from PyQt5.QtWidgets import *
- from PyQt5.QtCore import *
- from PyQt5.QtGui import *
- from y2 import *
- class Example(QWidget):
-
- def __init__(self):
- super().__init__()
- self.initUI()
- def initUI(self):
- self.resize(640, 320)
- self.bt = QPushButton('按钮',self)
- self.bt.setGeometry(200, 150, 200, 121)
- self.bt.clicked.connect(self.zyq)
- def zyq(self):
- y2.syq()
- if __name__ == "__main__":
- app = QApplication(sys.argv)
- d = Example()
- d.show()
- sys.exit(app.exec_())
复制代码
y2.py
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import sys
- from PyQt5.QtWidgets import QWidget,QApplication,QTextEdit,QVBoxLayout,QLabel
- from PyQt5.QtGui import QDragEnterEvent,QPixmap
- import os
- from PyQt5 import QtCore, QtGui, QtWidgets
- from PyQt5.QtWidgets import *
- from PyQt5.QtCore import *
- from PyQt5.QtGui import *
- class Example2(QWidget):
-
- def __init__(self):
- super().__init__()
- self.initUI()
- def initUI(self):
- self.resize(640, 320)
-
- def xyq(self):
- print('python')
- if __name__ == "__main__":
- app = QApplication(sys.argv)
- q = Example2()
- q.show()
- sys.exit(app.exec_())
复制代码
- class Example(QWidget):
-
- def __init__(self):
- super().__init__()
- self.initUI()
- def initUI(self):
- self.resize(640, 320)
- self.bt = QPushButton('按钮',self)
- self.bt.setGeometry(200, 150, 200, 121)
- self.bt.clicked.connect(self.zyq)
- def zyq(self):
- return Example2.xyq(self)
复制代码
|
|