D
D
Desmoke2021-05-13 19:40:49
Python
Desmoke, 2021-05-13 19:40:49

How to limit number of characters of lineEdit PyQT5?

Hello!

And so, I have a line edit, but I need to be able to enter only a certain number of numbers.
For example, the year of birth.
Make it a 4 character limit.
Or the limit is from 1 character to 5.
How???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jerwright, 2021-05-13
@Desmoke

Try this: Replace line_edit with your QLineEdit.
line_edit.setMaxLength(5)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question