I am making a PyQt5 application. I want to restrict the user to be able to enter only a single character in a QLineEdit object. Is this possible? If so, how?
Thanks in advance. :)
I am making a PyQt5 application. I want to restrict the user to be able to enter only a single character in a QLineEdit object. Is this possible? If so, how?
Thanks in advance. :)
QLineEdit has the maxLength property.
setMaxLength()
Sets the maximum number of characters for input
e1 = QLineEdit()
e1.setMaxLength(1)