loadUI command allows loading of a user interface created in Trolltech Qt Designer. Some Qt classes have equivalents in Maya. If a widget’s class is recognized, the Maya-equivelent will be created instead. Any dynamic properties on a widget which start with a ‘-‘ character will be treated as a MEL flag/value pair. Similarly, any which start with a ‘+’ will be treated as a Python flag/value pair. Such pairs will be applied to the widget upon creation.
| Long name (short name) | Argument Types | Properties | |
|---|---|---|---|
| listTypes (lt) | bool |   | |
| Returns the list of recognized UI types and their associated Maya command. Flag can have multiple arguments, passed either as a tuple or a list. | |||
| uiFile (f) | unicode |   | |
| 
 | |||
| uiString (s) | unicode |   | |
| 
 | |||
| verbose (v) | bool |   | |
| 
 | |||
| workingDirectory (wd) | unicode |   | |
| 
 | |||
Derived from mel command maya.cmds.loadUI
Example:
import pymel.core as pm
# Note: mydialog.ui must already exist
dialog1 = pm.loadUI(f='/users/username/mydialog.ui')
pm.showWindow(dialog1)
# Load from a string
dialogString = \\
r""""?xml version="1.0" encoding="UTF-8"?"
"ui version="4.0""
 "class"Dialog"/class"
 "widget class="QDialog" name="Dialog""
  "layout class="QVBoxLayout" name="verticalLayout""
   "item"
    "widget class="QLabel" name="label""
     "property name="text""
      "string"Test Dialog"/string"
     "/property"
    "/widget"
   "/item"
  "/layout"
 "/widget"
"/ui"
"""
dialog2 = pm.loadUI(uiString=dialogString)
pm.showWindow(dialog2)