Our application will contain two buttons. The first will be labeled Choose file, and it will display a dialog to select a file. By default, it will only show files with the .txt extension:
The second button will be Choose directory, and it will open a similar dialog to select a directory:
Both buttons will print the full path to the selected file or directory, and will not perform any action if the dialog is canceled.