Created
June 24, 2015 00:25
-
-
Save tritemio/8c79686ec07a1524ef9c to your computer and use it in GitHub Desktop.
Open file dialog for default ipython notebook in Anaconda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
version for Python 3.6 and PyQt5:
https://gist.github.com/denfromufa/080c1587829558334544992b566edbe3
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
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()