[英]Open a pop-up window after selecting files in QFileDialog - Python
I have a main window with upload button, after clicking the upload button a QFileDialog opens to upload the files. 我有一个带有上载按钮的主窗口,单击上载按钮后,将打开QFileDialog来上载文件。 How can I enable a pop-up to appear after selecting the files and clicking open button in the upload dialog? 选择文件并单击上载对话框中的打开按钮后,如何使弹出窗口出现?
I tried this one but it closes the program 我尝试了这个,但是它关闭了程序
def App(Qwidget, self):
w = QWidget()
w.resize(320, 240)
QFileDialog.getOpenFileNames(w, 'Open File', '/')
w.show()
self.EWindow = QtWidgets.QWidget()
self.ui = Ui_Form()
self.ui.setupUi(self.EWindow)
self.EWindow.show()
Using QPushButton clicked() event 使用QPushButton clicked()事件
button = QPushButton('Open', self)
button.clicked.connect(self.on_click)
calling QFileDialog and QMessageBox from QPushButton clicked() event 从QPushButton clicked()事件调用QFileDialog和QMessageBox
def on_click(self):
fileName, _ = QFileDialog.getOpenFileName(self,"Open File", "","All Files (*);;Python Files (*.py)")
if fileName:
print(fileName)
buttonReply = QMessageBox.question(self, 'Message Box', "Do you like PyQt5?", QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
if buttonReply == QMessageBox.Yes:
print('Yes clicked.')
else:
print('No clicked.')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.