


Example with PySide2:įrom PySide2 import QtWidgets my_label = QtWidgets. Like you probably guessed, all widgets are now created from QtWidgets. Perhaps the Qt Company thought QtGui got too bloated? The biggest change between the two, which you’ll notice since it breaks your old scripts, is that a bunch of stuff was taken out from QtGui and instead placed in the new QtWidgets module. I’m writing “Qt4 and Qt5” instead of “PySide and PySide2” or “PyQt4 and PyQt5” since we’re talking about similar Python bindings which in the end uses Qt. Instead you should use use PyQt5 which are the new Python bindings for Qt5. You also cannot use PyQt4 with Maya 2017, as they are also Python bindings for Qt4. With this comes a bunch of changes, so unfortunately, you can’t just “ import PySide2” instead of “ import PySide” and then expect your old scripts to work. PySide2 are the new Python bindings for Qt5 and is now bundled with Maya 2017. So naturally, when Qt4 no longer exists in Maya, PySide doesn’t work anymore and was therefore removed in Maya 2017. When you use PySide (or PyQt4), you’re actually using the Python bindings for Qt4. Unfortunately, this also breaks backwards compatibility to Qt4. Today, roughly 11 years after the Qt4 release, and starting with Maya 2017, Qt was upgraded to version 5 (“Qt5”) to enable a host of enhancements to Maya. Up until and including Maya 2016, Qt of version 4 (“Qt4”) which was released in 2005 has been used.

Starting with Maya 2011, Maya’s user interface is built using the Qt toolkit. Nuke or any other Python-enabled DCC app which uses Qt. This guide explains how to deal with that and make your Python and PySide/PyQt scripts compatible with Maya 2017 as well as older Maya versions. Maya 2017 was released today and with it comes a big change PySide (and PyQt4) no longer works with Maya. Dealing with Maya 2017 and PySide2 #Python #Maya #Qt.py #PySide #PyQt
