Skip to content

Instantly share code, notes, and snippets.

@den-run-ai
Forked from tritemio/open file dialog
Last active March 4, 2020 16:29
Show Gist options
  • Save den-run-ai/080c1587829558334544992b566edbe3 to your computer and use it in GitHub Desktop.
Save den-run-ai/080c1587829558334544992b566edbe3 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 = QtWidgets.QFileDialog.getOpenFileName(None, "Select a file...", '.', filter="All files (*)")
return str(fname)
@soumyabrataghosh
Copy link

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