import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
class Example(QMainWindow):
send = pyqtSignal(tuple)
def __init__(self):
super().__init__()
self.initUI()
@pyqtSlot()
def initUI(self):
self.setWindowTitle("Пример")
self.setGeometry(300, 300, 250, 100)
self.line_edit = QLineEdit(self)
self.line_edit.setGeometry(0, 0, 250, 33)
self.line_edit_2 = QLineEdit(self)
self.line_edit_2.setGeometry(0, 33, 250, 33)
self.button = QPushButton('Запуск', self)
self.button.clicked.connect(self.start)
self.button.setGeometry(0, 66, 250, 34)
self.send.connect(self.print)
def start(self):
# print("LineEdit get text:", self.line_edit.text())
# print("LineEdit2 get text:", self.line_edit_2.text())
str_tuple = (self.line_edit.text(), self.line_edit_2.text())
self.send.emit(str_tuple)
def print(self, data):
print(data)
if __name__ == '__main__':
application = QApplication(sys.argv)
window = Example()
window.show()
sys.exit(application.exec_())