Supporting PySide and PyQt

For the purposes of this book, there are two differences between PySide and PyQt. We will use the qtshim.py file to swap between the two depending on what is available. When the module is imported, it will choose between PySide and PyQt implementations, depending on what is available.

The qtshim.py module contains four attributes:

  • The QtCore and QtGui namespaces, pulled from the imported implementation.
  • The Signal class, which just aliases the PySide.QtCore.Signal or PyQt4.QtCore.pyqtSignal class.
  • The wrapinstance function which takes a pointer to a Qt object and returns the Qt object it points to. A pointer here is a long integer that refers to the memory location of the underlying Qt object. There is a significant difference ...

Get Practical Maya Programming with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.