File Open dialog (Python)

File Open dialog (Python)
 1# This example shows how to use the FileOpenDialog Object
 2
 3# Create the dialog object (but None is displayed yet)
 4fileOpenDialog = impact.gui.create_file_open_dialog()
 5
 6# Apply the specified filename, filepath and title to the new FileOpenDialog object
 7fileOpenDialog.file_path = "D:\\"
 8fileOpenDialog.file_name = "Picture.bmp"
 9fileOpenDialog.title = "File Open"
10
11# Now display the dialog, then check which button was pressed
12if fileOpenDialog.show_modal():
13    impact.gui.output_toolbox.add( "The user pressed the Open button." )
14else:
15    impact.gui.output_toolbox.add( "The user pressed the Cancel button." )
16
17# Output the edited filename and filepath
18impact.gui.output_toolbox.add( "FilePath: " + fileOpenDialog.file_path )
19impact.gui.output_toolbox.add( "FileName: " + fileOpenDialog.file_name )