简体   繁体   中英

QFileDialog close on OK button activation

I am using pyqt4 and windows. I have an application where I select a directory using QFileDialog. After the directory is selected, I want to close the file dialog when the user selects the OK button of the file dialog. The behavior desired should be the same as the behavior of the cancel button. How can I do this?

Thanks

使用QFileDialog.getExistingDirectory()静态方法。

 dir = QtGui.QFileDialog.getExistingDirectory(self);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM