Shannon Hochkins
Shannon Hochkins

Reputation: 12186

How do I create an OpenMaya UI?

I don't know how to create a UI with MayaApi, all I have done in the past is something like this:

import pymel.core as pm
winWidth = 400
if pm.window("window", exists=1): pm.deleteUI("window")
pm.window("window", w=winWidth)   
with pm.columnLayout('content', adjustableColumn=True):             
    with pm.rowColumnLayout(nc=1):
        pm.text(l="wooo! A window! ")

However, is there a way to create a UI without the use of pymel?

Upvotes: 0

Views: 1403

Answers (3)

user-2147482637
user-2147482637

Reputation: 2163

You can use pyqt designer to create a GUI, then pyuic4 to convert it into python. From there you can setup your callbacks and signals in python. Here is a tutorial: http://www.geoffsamuel.com/Tutorials/Intro_Maya_QT.php

Or use the maya.cmds and create your windows and buttons with the built in qt features of maya

Upvotes: 2

theodox
theodox

Reputation: 12218

Unless you're doing something pretty hardcore - like you need to do custom openGL drawing in a 3d view - the complexity and potential drawbacks of doing ordinary UI in the API directly outweigh the pluses. Python will be slower - but probably not in ways that users notice. And it's much harder to force-exit your maya with a typo in Python than in the API :)

Upvotes: 2

Argiri Kotsaris
Argiri Kotsaris

Reputation: 492

Have you tried here. Autodesk has it's own docs for this.

Upvotes: 1

Related Questions