Skip to content

Instantly share code, notes, and snippets.

@tritemio
Created June 24, 2015 00:25
Show Gist options
  • Save tritemio/8c79686ec07a1524ef9c to your computer and use it in GitHub Desktop.
Save tritemio/8c79686ec07a1524ef9c to your computer and use it in GitHub Desktop.
Open file dialog for default ipython notebook in Anaconda
def openfile_dialog():
from PyQt4 import QtGui
app = QtGui.QApplication([dir])
fname = QtGui.QFileDialog.getOpenFileName(None, "Select a file...", '.', filter="All files (*)")
return str(fname)
@RDeRenzi
Copy link

In my case (ipython 2.7)
file = openfile_dialog()
leaves the dialog hanging as soon as I double click on a file.
Ipython gets the file name correctly, but there is no way to close the dialog window.
If I xkill the dialog, ipython is still working but it crushes as soon as I reissue the command
file = openfile_dialog()

@den-run-ai
Copy link

@josephcslater
Copy link

Using this two times in a row causes it to simply freeze. Is there something that has to be closed before using it again?

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