PyQt4 Inside Maya2011

Since the version of 2011, Maya User Interface is based on Qt. Using PyQt4 inside Maya2011 should be easier. Before version 2011, PyQt4 is hooked to Maya by pumpThread, and it is not a part of Maya UI, and will always annoyingly drop to background as soon as the Maya UI is focused.  Maya2011 can parent a QMainWIndow to Maya main window, making it a part of Maya UI. Focusing problem is gone.

Like versions before it, Maya2011 installation doesn’t include PyQt4. Install PyQt4 separately, and copy PyQt4 directory and SIP files to Maya2011/Python/Lib/site-packages/. The catch is the latest build of PyQt4 won’t work. Maya2011 is compiled against a specific version of Qt (4.6?). Those Qt dlls reside in Maya2011/bin/ won’t match PyQt4 compiled agianst newer versions of Qt, you will have DLL errors! And those dlls cannot be overridden, or Maya will fail to load. The matched version of PyQt4 should be PyQt-Py2.6-gpl-4.6. I found a copy for 64-bit application here. To test if it works, open mayapy.exe in Maya2011/bin/, and run:

from PyQt4 import QtCore

If no error appears, everything will be fine.

Revised: Maya2011 is compiled against Qt4.7 per doc. So I think any PyQt4 build not newer than 4.7 will do.


Leave a comment

Filed under Maya API, Python

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s