1.NameError: name 'QApplication' is not defined
from PyQt5.QtWidgets import QApplication
2.NameError: name 'QLabel' is not defined
from PyQt5.QtWidgets import *
3.NameError: name 'QDialog' is not defined
from PyQt5.QtWidgets import QInputDialog, QLineEdit, QDialog
4.AttributeError: 'Form' object has no attribute 'connect'
In PyQt5 you need to use the connect() and emit() methods of the bound signal directly, e.g. instead of:
self.emit(pyqtSignal('add_post(QString)'), top_post)
self.connect(self.get_thread, pyqtSignal("add_post(QString)"), self.add_post)
self.connect(self.get_thread, pyqtSignal("finished()"), self.done)
use:
self.add_post.emit(top_post)
self.get_thread.add_post.connect(self.add_post)
self.get_thread.finished.connect(self.done)
https://stackoverflow.com/questions/41848769/pyqt5-object-has-no-attribute-connect
5.NameError: name 'unicode' is not defined
Python 3 renamed the unicode
type to str
, the old str
type has been replaced by bytes
.