Check whether the QLineEdit is empty or not

I am Newbie to Python and PyQt5.

Just I want to know, How to create a Class/Module to check whether the QLineEdit is empty or not ? and how to import this Module in another Programme/File?

Expect Your Reply.

Hey @Deebalaji

You don’t really need a class/module to check something as simple as that. On a QLineEdit you can get the current contents using .text()

Since in Python an empty string “” is falsey and any content is truthy you can just use that value for your conditional, e.g.

if lineedit.text():
     # do something if there is content in the line edit.