pymel.core.system.fileDialog2

fileDialog2(*args, **kwargs)

This command provides a dialog that allows users to select files or directories.

Flags:
Long name (short name) Argument Types Properties
acceptMode (am) int ../../../_images/create.gif
 
Indicate if the dialog is for opening or saving files. 0 Opening1 Saving
cancelCaption (cc) unicode ../../../_images/create.gif
 
If the dialogStyle flag is set to 2 then this provides a caption for the Cancel button within the dialog.
caption (cap) unicode ../../../_images/create.gif
 
Provide a title for the dialog.
dialogStyle (ds) int ../../../_images/create.gif
 
1 On Windows or Mac OS X will use a native style file dialog.2 Use a custom file dialog with a style that is consistent across platforms.
fileFilter (ff) unicode ../../../_images/create.gif
 
Provide a list of file type filters to the dialog. Multiple filters should be separated by double semi-colons. See the examples section.
fileMode (fm) int ../../../_images/create.gif
 

Indicate what the dialog is to return. 0 Any file, whether it exists or not.1 A single existing file.2 The name of a directory. Both directories and files are displayed in the dialog.3 The name of a directory. Only directories are displayed in the dialog.4 Then names of one or more existing files.

fileTypeChanged (ftc) callable  
   
okCaption (okc) unicode ../../../_images/create.gif
 
If the dialogStyle flag is set to 2 then this provides a caption for the OK, or Accept, button within the dialog.
optionsUICommit (ocm) callable  
   
optionsUICreate (ocr) callable  
   
optionsUIInit (oin) callable  
   
returnFilter (rf) bool ../../../_images/create.gif
 

If true, the selected filter will be returned as the last item in the string array along with the selected files. Flag can have multiple arguments, passed either as a tuple or a list.

selectFileFilter (sff) unicode ../../../_images/create.gif
 
Specify the initial file filter to select. Specify just the begining text and not the full wildcard spec.
selectionChanged (sc) callable  
   
startingDirectory (dir) unicode ../../../_images/create.gif
 
Provide the starting directory for the dialog.

Derived from mel command maya.cmds.fileDialog2

Example:

import pymel.core as pm

import maya.cmds as cmds

basicFilter = "*.mb"
pm.fileDialog2(fileFilter=basicFilter, dialogStyle=2)

singleFilter = "All Files (*.*)"
pm.fileDialog2(fileFilter=singleFilter, dialogStyle=2)

multipleFilters = "Maya Files (*.ma *.mb);;Maya ASCII (*.ma);;Maya Binary (*.mb);;All Files (*.*)"
pm.fileDialog2(fileFilter=multipleFilters, dialogStyle=2)

Previous topic

pymel.core.system.fileDialog

Next topic

pymel.core.system.findType

Core

Core Modules

Other Modules

This Page