pymel.core.windows.confirmDialog

confirmDialog(*args, **kwargs)

The confirmDialog command creates a modal dialog with a message to the user and a variable number of buttons to dismiss the dialog. The dialog is dismissed when the user presses any button or chooses the close item from the window menu. In the case where a button is pressed then the name of the button selected is returned. If the dialog is dismissed via the close item then the string returned is specified by the dismissStringflag. The default behaviour when no arguments are specified is to create an empty single button dialog.

Flags:

Long Name / Short Name Argument Types Properties
annotation / ann unicode ../../../_images/create.gif
  set the annotation for the buttons
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)
button / b unicode ../../../_images/create.gif
  Create a button with the given string as it’s text.
cancelButton / cb unicode ../../../_images/create.gif
  The cancel button is activated by pressing the escape key. Note that this flag does not create a button, it simply indicates which button created via the buttonflag shall respond to the escape key.
defaultButton / db unicode ../../../_images/create.gif
  The default button is activated by pressing the enter key. Note that this flag does not create a button, it simply indicates which button created via the buttonflag shall respond to the enter key.
dismissString / ds unicode ../../../_images/create.gif
  The string returned when the user selects the ‘Close’ item from the Window Manager menu. If this flag is not set then the string dismissis returned.
icon / icn unicode ../../../_images/create.gif
  The user can specify one of the four standard icons – question, information, warningand critical. The question icon indicates that the messsage is asking a question. The information icon indicates that the message is nothing out of the ordinary. The warning icon indicates that the message is a warning, but can be dealt with. The critical icon indicates that the message represents a critical problem. When no icon flag is present, we assume the user does not want to include any icon in the confirm dialog.
message / m unicode ../../../_images/create.gif
  The message text appearing in the dialog.
messageAlign / ma unicode ../../../_images/create.gif
  Align the message left, center, or right.
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. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.confirmDialog

Example:

import pymel.core as pm


# Create an empty single button dialog.
#

pm.confirmDialog()
# Result: u'Confirm' #


# Create a basic Yes/No dialog.
#

pm.confirmDialog( title='Confirm', message='Are you sure?', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
# Result: u'Yes' #