NameError: name 'Qt' is not defined
-
Hi,
If you did just:
import PyQt5
Then it won't be able to find the Qt namespace because you only made the PyQt5 namespace available.
-
Yes but if I write
from...import....
I get circular imports! What should I do?
-
Use the fully qualified name.
How do you create circular imports by using PyQt5 ?
-
This is what I am trying to find out. What is the command of what you are writing?
-
@john_hobbyist
Which circular imports where?You can do this from PyQt5:
from PyQt5.QtCore import Qt
and then your original code should work.
In fairness, it is a bit complicated. https://stackoverflow.com/questions/39316693/how-to-import-from-qt-namespase-qt5-python3-x, the solution there, describes the situation and why this works, if you care.
-
PyQt5.QtCore.Qt.Whatever
Or more simply:
from PyQt5.QtCore import Qt
and then use Qt.
-
Amazing! It works!!! Thanks a lot for your time!
-
@john_hobbyist said in NameError: name 'Qt' is not defined:
It works!!!
so please don't forget to mark your post as solved!
-
Detail ModuleNotFoundError: No module named 'PyQt5' im still facing this issue
-
@sneha_chavan_07 Then please provide more information. Did you install PyQt5 and how? On which OS?