Due to a miscommunication between Elsevier Press and the Python Software Foundation, the first printing of this title used an unauthorized modification of the trademarked Python logo. We apologize to the PSF for this, and they have been understanding of our in-press status; in the 2nd and subsequent printing of this title, we shall use a cover design that has been approved as non-dilutive by the Python Software Foundation.

Help make the world a better place and make a secure donation to the Python Software Foundation today!

 

Chapter 8

Advanced Graphical User Interfaces with Qt

Author

Kristine Middlemiss

Project

Install Qt and build basic window with Qt Designer

Example Files

polywin.py
coneptrwin.py
cone.ui

Synopsis

This chapter expands upon the previous one by introducing concepts of GUI creation using Qt. The chapter first explains how Qt is integrated into Maya. Next, readers will download and install Qt tools. Readers then walk through an example in Qt Designer to create a basic window that can communicate with Maya commands. In the process, readers will be exposed to Qt’s signal/slot mechanism for using non-native Qt controls in Maya. Finally, the chapter concludes with a brief discussion of PyQt.

Resources

Qt download links and build instructions
The dockControl Command
Using Qt Designer for MEL Interfaces
Qt Reference Documentation
Rapid GUI Programming with Python and Qt: The Definitive Guide to PyQt Programming
Ten Usability Heuristics

Other Notes

None

Errata for the First Edition

On p. 236, for the first step in the Docking Windows section, there is a code sample for docking the Graph Editor. In the final line containing the scriptedPanel call, the parent needs to be the variable layout, rather than the string literal 'layout'.


6 Responses to “Chapter 8”

  1. On p.238, it says to look in the API guide to find out the compatible Qt version, but the indicated page does not exist in the guide any more. Qt information has been moved elsewhere in the guide, but no definitive statement is made there as to the Qt version. Instead, it seems that you need to consult the version number of the compressed Qt headers file, in the Maya include directory – on OS X, this is /Applications/Autodesk/maya2014/devkit/include , for “qt-4.8.2-include.tar.gz”.

  2. I really like the book and am learning quite a lot about programming using python. Would it be possible for me to query the types of meshes in a scene and then view them in a QListView widget created using the qt designer? I would greatly appreciate any help I can get on the subject. Great book, btw. very helpful

  3. How can I install Qt for Maya 2016? there doesn’t seem to be any documentation on this, and I am stuck at this point in the book.

  4. Struggling to get the coneptrwin.py to work in Maya 2015.
    Using the linked file above, I get this when I click the button:
    ‘ar_conePtrWindow|centralwidget|inputRotation’ not found.

    Line 19 states: self.window = ‘ar_conePtrWindow’
    Definitely not a typo! That name does not point to anything…

    • Hi! Which linked file are you using exactly? When I used the linked coneptrwin.py and cone.ui it works for me in Maya 2017. Can you verify that the ui file you are using has the correct widget names so that path to that control is valid?

Leave a Reply

Your email address will not be published. Required fields are marked *