qlineedit textchanged example python

Example 1: pyqt5 qlineedit on change

self.MyInput.textChanged.connect(self.doSomething)

Example 2: pyqt5 editline

import sysfrom PyQt5 import QtCore, QtWidgetsfrom PyQt5.QtWidgets import QMainWindow, QWidget, QLabel, QLineEditfrom PyQt5.QtWidgets import QPushButtonfrom PyQt5.QtCore import QSize    class MainWindow(QMainWindow):    def __init__(self):        QMainWindow.__init__(self)        self.setMinimumSize(QSize(320, 140))            self.setWindowTitle("PyQt Line Edit example (textfield) - pythonprogramminglanguage.com")         self.nameLabel = QLabel(self)        self.nameLabel.setText('Name:')        self.line = QLineEdit(self)        self.line.move(80, 20)        self.line.resize(200, 32)        self.nameLabel.move(20, 20)        pybutton = QPushButton('OK', self)        pybutton.clicked.connect(self.clickMethod)        pybutton.resize(200,32)        pybutton.move(80, 60)            def clickMethod(self):        print('Your name: ' + self.line.text())if __name__ == "__main__":    app = QtWidgets.QApplication(sys.argv)    mainWin = MainWindow()    mainWin.show()    sys.exit( app.exec_() )