0
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon


##

logo_location = 'C:\\Users\\gbytt\\Dropbox\\[A] 공유폴더\\[E] VScode\\PyQt\\logo.png'

##

class MyApp(QWidget):

  def __init__(self):
      super().__init__()
      self.initUI()

  def initUI(self):
      self.setWindowTitle('Icon')
      self.setWindowIcon(QIcon(logo_location))
      self.setGeometry(300, 300, 300, 200)
      self.show()


if __name__ == '__main__':
  app = QApplication(sys.argv)
  ex = MyApp()
  sys.exit(app.exec_())

Error appears as below

No name 'QApplication' in module 'PyQt5.QtWidgets'
No name 'QWidget' in module 'PyQt5.QtWidgets'
No name 'QIcon' in module 'PyQt5.QtGui'

But in IDLE it runs neatly without any errors.

Also, if you create a .pylintrc file and wirte 'extension-pkg-whitelist=pyQt5' and insert it, an error appears as shown below.

No name 'QApplication' in module 'PyQt5.QtWidgets'
No name 'QWidget' in module 'PyQt5.QtWidgets'
No name 'QIcon' in module 'PyQt5.QtGui'
Bad indentation. Found 2 spaces, expected 4
Bad indentation. Found 6 spaces, expected 8
Bad indentation. Found 6 spaces, expected 8
Bad indentation. Found 2 spaces, expected 4
Bad indentation. Found 6 spaces, expected 8
Bad indentation. Found 6 spaces, expected 8
Bad indentation. Found 6 spaces, expected 8
Bad indentation. Found 6 spaces, expected 8
Bad indentation. Found 2 spaces, expected 4
Bad indentation. Found 2 spaces, expected 4
Bad indentation. Found 2 spaces, expected 4
Module name "Framework" doesn't conform to snake_case nameing style
Missing module docstring
Constant name "logo_localtion" doesn't confrom to UPPER_CASE nameing style
Missing class docstring
Method name "initUI" doesn't confrom to snake_case naming style
Missing function or method docstring
Final newline missing
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
tt APX
  • 67
  • 1
  • 5
  • Even if the method is performed, there is an error as below. Bad indentation. Found 2 spaces, expected 4 Bad indentation. Found 6 spaces, expected 8 .. Module name "Framework" doesn't conform to snake_case nameing style Missing module docstring Constant name "logo_localtion" doesn't confrom to UPPER_CASE nameing style Missing class docstring Method name "initUI" doesn't confrom to snake_case naming style Missing function or method docstring Final newline missing – tt APX Dec 29 '20 at 01:38
  • The duplicate already solved the error related to PyQt and pylint, the other errors are indentation, etc. If you don't want to get an error then you can disable linting: https://code.visualstudio.com/docs/python/linting#_disable-linting – eyllanesc Dec 29 '20 at 01:42

0 Answers0