On this page |
This class inherits from Qt’s QtWidgets.QToolButton
class.
Signals ¶
fileSelected(str)
This signal is emitted when a selection is made in the file chooser dialog.
Methods ¶
__init__()
Create and return a new FileChooserButton object.
setFileChooserStartDirectory(start_dir)
Set the initial directory that the file chooser dialog will open in.
setFileChooserTitle(title)
Set the window title of the file chooser dialog.
setFileChooserFilter(file_filter)
Set the file filter in the chooser dialog.
file_filter
must be a hou.fileType value.
setFileChooserPattern(file_pattern)
Set the pattern used by the file chooser dialog. The dialog only lists files that match the pattern.
setFileChooserDefaultValue(default_value)
Set the default value in the file chooser dialog. The default value is used to populate the file name field in the dialog.
setFileChooserMultipleSelect(multiple_select)
Set whether the file chooser dialog accepts multiple selection.
setFileChooserIsImageChooser(is_image_chooser)
Set whether the file chooser dialog will be used to select image files. Image thumbnails are shown in the dialog. The default is for the dialog to not be used solely for selecting image files.
setFileChooserMode(chooser_mode)
Set the mode of the file chooser dialog.
chooser_mode
must be a hou.fileChooserMode value.
Examples ¶
This example demonstrates creating a file chooser button and hooking it to a callback function that is invoked when a file is selected from the chooser dialog:
def onFileSelected(file_path): print("Selected file:", file_path) file_chooser_btn = hou.qt.FileChooserButton() file_chooser_btn.setFileChooserTitle("Please select a file") file_chooser_btn.setFileChooserMode(hou.fileChooserMode.Read) file_chooser_btn.fileSelected.connect(onFileSelected)