Is there a way to trigger a "folder open" from Sublime Text 3 API?

241 views Asked by At

I working on a plugin which will generate some file and I need to prompt the user somehow so that he selects a folder where these files will be generated.

Is there a way to do this with Sublime Text 3 API?

1

There are 1 answers

2
MattDMo On

Probably the most straightforward way would be to open an input box (sublime.show_input_panel()) with a default value and allow the user to enter their own path if desired.

If you were using the standard Python 3 distribution from python.org, you could always use something like tkinter.tix.DirSelectDialog() or tkinter.filedialog, but the stripped-down version of Python 3.3.3 shipped with Sublime Text 3 does not include several modules, including tkinter. If a graphical interface is important to you, you may want to consider including a small GUI toolkit like easygui with your plugin.