Multiple inheritance metaclass conflict

The problem in your case is that the classes you try to inherit from have different metaclasses: >>> type(QStandardItem) <class ‘sip.wrappertype’> >>> type(ConfigParser) <class ‘abc.ABCMeta’> Therefore python can’t decide which should be the metaclass for the newly created class. In this case, it would have to be a class inheriting from both sip.wrappertype (or PyQt5.QtCore.pyqtWrapperType … Read more

Cannot import QtWebKitWidgets in PyQt5

QtWebKit got deprecated upstream in Qt 5.5 and removed in 5.6. You may want to switch to PyQt5.QtWebEngineWidgets.QWebEngineView. For basic use of PyQt5.QtWebKitWidgets.QWebView, it can simply be updated to use PyQt5.QtWebEngineWidgets.QWebEngineView in the source code, but there may be some differences in the new component which require further adjustments.

No name ‘QApplication’ in module ‘PyQt5.QtWidgets’ error in Pylint

I’ve figured out the issue, apparently Pylint doesn’t load any C extensions by default, because those can run arbitrary code. So I found that if you create a system file in your project directory with the file named .pylintrc the rc file can whitelist this package to stop throwing errors by adding the following code … Read more

Proper way to quit/exit a PyQt program

Calling QCoreApplication.quit() is the same as calling QCoreApplication.exit(0). To quote from the qt docs: After this function has been called, the application leaves the main event loop and returns from the call to exec(). The exec() function returns returnCode. If the event loop is not running, this function does nothing. [emphasis added] So quit() or … Read more

How to build multiple .py files into a single executable file using pyinstaller?

Suppose you had a file called create.py like def square (num) return num ** 2 Another file in the same directory called input.py from . import create def take_input(): x = input(“Enter Input”) return create.square(x) And finally your main.py from . import input if __name__ == ‘__main__’: ip = input.take_input() You will call the command … Read more

This application failed to start because it could not find or load the Qt platform plugin “cocoa”

When building an app with cx_Freeze on MacOSX all dependent libraries (.so files on MacOSX) are packaged into the application bundle. It is this that makes the application portable to other systems, without requiring a second install of Qt. When launching the Application, the libraries should therefore be loaded from within the bundle. However, in … Read more

How to set QComboBox to item from item’s text in PyQt/PySide

Yes, there is QComboBox.findText, which will return the index of the matched item (or -1, if there isn’t one). By default, the search does exact, case-sensitive matching, but you can tweak the behaviour by passing some match-flags as the second argument. For example, to do case-insensitive matching: index = combo.findText(text, QtCore.Qt.MatchFixedString) if index >= 0: … Read more