I'm trying to create a function in a register and login form using QLineEdit to show and hide password if click a QPushButton. I'm a beginner in Python, I'm just trying to do it but it's very hard... My attempt is not good because if I click the eye button the password is shown, but if click again to hide it does not work. from PyQt5 import QtCore, QtGui, QtWidgets, uic from PyQt5.QtWidgets import QPushButton, QLineEdit import sys import pymysql pymysql.install_as_MySQLdb() class MyWindow(QtWidgets.QMainWindow): def __init__(self, maxWidth=None): super(MyWindow, self).__init__() uic.loadUi('MainWindow.ui', self) self.eyepass_show() self.eyepass_hide() self.btn_show_pwd.clicked.connect(self.eyepass_hide) self.btn_show_pwd.clicked.connect(self.eyepass_show) def eyepass_show(self): self.line_password.setEchoMode(QLineEdit.Normal) print('show pass') def eyepass_hide(self): self.line_password.setEchoMode(QLineEdit.Password) print('hide pass') if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = MyWindow() window.show() sys.exit(app.exec_()) form password hide/show eye: is hiding password is show but if click again to hide not work Continue reading...