PyQt has two different API's: the old and the new. By default you get the old API with Python 2 and the new API with Python 3. Is it possible to enable the new PyQt API with Python 2? How?
From this reddit comment,
import sip
API_NAMES = ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]
API_VERSION = 2
for name in API_NAMES:
sip.setapi(name, API_VERSION)
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtSvg import *
from PyQt4.QtCore import pyqtSignal as Signal
from PyQt4.QtCore import pyqtSlot as Slot
(...although I would recommend from PyQt4 import QtCore
etc instead of import *
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With