My qt application runs a process and saves the results in a particular directory.
Now user has to go to the folder for viewing the results. Generally will be a excel file.
I have tried getExistingDirectory/getOpenFileName where it opens the dir path for choosing the folder or opening the file.
I just want to open a folder independent of pyqt4. (For ex : Pressing "Windows + E" shortcut key in windows.
from PyQt4 import QtGui,QtCore
import sys,os
class OpenDir(QtGui.QMainWindow):
def __init__(self):
super(OpenDir, self).__init__()
# self.openDirectory()
self.button = QtGui.QPushButton('Open', self)
self.button.clicked.connect(self.openDirectory)
self.setCentralWidget(self.button)
def openDirectory(self):
print "Hi i am openDirectory Function . I will open Directory selected "
openDirectoryDialog=QtGui.QFileDialog()
print openDirectoryDialog
# oD=openDirectoryDialog.getExistingDirectory(self,"open",os.path.abspath("..\."),openDirectoryDialog.ShowDirsOnly) #Selectes folder
# oD = openDirectoryDialog.directoryEntered(self,"open", os.path.abspath("..\."))
print oD
if len(oD) > 0:
print "accepted"
else:
print "nothing selected"
def main():
app = QtGui.QApplication(sys.argv)
ui=OpenDir()
ui.show()
sys.exit(app.exec_())
#Function Main END
if __name__ == '__main__':
main()