OCC.Display.backend module

get_loaded_backend()
get_qt_modules()
tuple : ( QtCore, QtGui, QtWidgets, QtOpenGL )
here QtWidgets shadows QtGui when a PyQt4 or PySide module is loaded this is the most coherent way to get PyQt5 compliant code
ValueError
when no Qt backend has been yet loaded informs the user to call load_backend or that no Qt python module ( PyQt5, PyQt4 or PySide ) is found
load_backend(backend_str=None)

loads a gui backend

If no Qt (such as PyQt5, PyQt4 or PySide) backend is found, wx is loaded

The search order for pythonocc compatible gui modules is:
PyQt5, PyQt4, PySide, Wx

Wx is imported when no Qt backend is found.

backend_str : str

specifies which backend to load

backend_str is one of ( “qt-pyqt5”, “qt-pyqt4”, “qt-pyside”, “wx” )

if no value has been set, load the first module in gui module search order

str
the name of the loaded backend one of ( “qt-pyqt5”, “qt-pyqt4”, “qt-pyside”, “wx” )
ValueError
  • when a backend is already loaded
  • when an invalid backend_str is specified
ImportError
when the backend specified in backend_str could not be imported
load_pyqt4()

returns True is PyQt4 found, else False

load_pyqt5()

returns True is PyQt5 found, else False

load_pyside()

returns True is PySide found, else False

load_wx()

returns True is wxPython found, else False

loaded_backend()