Check whether a QLineEdit is empty or not

Heads up! You've already completed this tutorial.

Deebalaji asked

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?

You don't need a class/module to check something as simple as that. PyQt5 Widgets all have their own methods which can be used to get the current state of the widgets. 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.

Hope that helps!

The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

Check whether a QLineEdit is empty or not was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.