How to Solve NameError: name 'QIcon' is not defined -- PyQt5

Solution: Import the 'QIcon' module

To Solve the error, add the following line to the top of your code.

from PyQt5.QtGui import QIcon

 

For more information:
Python PyQt5 QIcon