Skip to content

Instantly share code, notes, and snippets.

@soumyabrataghosh
Forked from den-run-ai/open file dialog
Last active March 4, 2020 16:29
Show Gist options
  • Save soumyabrataghosh/6a33350a42748ed821ce80283de2ad07 to your computer and use it in GitHub Desktop.
Save soumyabrataghosh/6a33350a42748ed821ce80283de2ad07 to your computer and use it in GitHub Desktop.
Open file dialog for default ipython notebook in Anaconda
def openfile_dialog():
from PyQt5 import QtGui
from PyQt5 import QtGui, QtWidgets
app = QtWidgets.QApplication([dir])
fname,_filter = QtWidgets.QFileDialog.getOpenFileName(None, "Select a file...", '.', filter="All files (*)")
return str(fname)
@soumyabrataghosh
Copy link
Author

fname,_filter = QtWidgets.QFileDialog.getOpenFileName(None, "Select a file...", '.', filter="All files (*)")
This is required to return only the file name.
https://stackoverflow.com/a/43509281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment