Reputation: 3137
This code works perfectly fine on mac, after clicking on the button, the dir dialog show up. On Windows, it freezes after the button clicks (refer to the picture).
Here is my code:
import os
import sys
from Pyside import QtGui
class OpenDir(QtGui.QWidget):
def __init__(self):
super(OpenDir, self).__init__()
self.initUI()
def initUI(self):
self.openDir = QtGui.QPushButton('Dialog', self)
self.openDir.move(20, 20);
self.openDir.clicked.connect(self.open_dir)
self.show()
def open_dir(self):
self.filename = QtGui.QFileDialog.getExistingDirectory(self,
"open dir", os.getcwd())
def main():
app = QtGui.QApplication(sys.argv)
ui = OpenDir()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
Updated:
Error after clicking on dialog button.
Upvotes: 2
Views: 1189
Reputation: 3137
I fixed my problem by installing Python 3.4.3. So I assume this must be compatibility between PyQt/PySide and Python distributions (Anaconda).
Upvotes: 1