pymel.core.windows.layoutDialog

layoutDialog(*args, **kwargs)

The layoutDialog command creates a modal dialog containing a formLayout with 100 divisions. The formLayout can be populated with arbitrary UI elements through use of the ‘-ui/-uiScript’ flag. NOTE:A layoutDialog is not a window and certain UI elements will not function properly within it. In particular menuBars and panels containing menuBars should not be used with the layoutDialog.

Flags:

Long Name / Short Name Argument Types Properties
backgroundColor / bgc float, float, float ../../../_images/create.gif
  The background color of the dialog. The arguments correspond to the red, green, and blue color components. Each component ranges in value from 0.0 to 1.0. (Windows only flag)
dismiss / dis unicode ../../../_images/create.gif
  Dismiss the current layoutDialog. The specified string will be set as the result of the initial layoutDialog command.
parent / p unicode ../../../_images/create.gif
  Specify the parent window for the dialog. The dialog will be centered on this window and raise and lower with it’s parent. By default, the dialog is not parented to a particular window and is simply centered on the screen.
title / t unicode ../../../_images/create.gif
  The dialog title.
uiScript / ui script ../../../_images/create.gif
  The specified MEL procedure name will be invoked to build the UI of the layoutDialog. This flag is required when creating a layoutDialog. The top-level control of a layoutDialog is a formLayout with 100 divisions. It can be accessed by calling ‘setParent -q’ at the beginning of the specified MEL procedure. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.layoutDialog

Example:

import pymel.core as pm

def checkboxPrompt():
        # Get the dialog's formLayout.
        #
        form = pm.setParent(q=True)

        # layoutDialog's are not resizable, so hard code a size here,
        # to make sure all UI elements are visible.
        #
        pm.formLayout(form, e=True, width=300)

        t = pm.text(l='What do you want to do?')

        b1 = pm.button(l='Abort', c='pm.layoutDialog( dismiss="Abort" )' )
        b2 = pm.button(l='Skip', c='pm.layoutDialog( dismiss="Skip" )' )
        b3 = pm.button(l='Continue', c='pm.layoutDialog( dismiss="Continue" )' )

        cb1 = pm.checkBox(label='Remember my choice')

        spacer = 5
        top = 5
        edge = 5

        pm.formLayout(form, edit=True,
                                        attachForm=[(t, 'top', top), (t, 'left', edge), (t, 'right', edge), (b1, 'left', edge), (b3, 'right', edge), (cb1, 'left', edge), (cb1, 'bottom', spacer)],
                                        attachNone=[(t, 'bottom'), (b1, 'bottom'), (b2, 'bottom'), (b3, 'bottom'), (cb1, 'right')],
                                        attachControl=[(b1, 'top', spacer, t), (b2, 'top', spacer, t), (b3, 'top', spacer, t), (cb1, 'top', spacer, b1)],
                                        attachPosition=[(b1, 'right', spacer, 33), (b2, 'left', spacer, 33), (b2, 'right', spacer, 66), (b3, 'left', spacer, 66)])

print pm.layoutDialog(ui=checkboxPrompt)