用PyQt5做圖形化界面,問題相關代碼:
def chooseFiles(self):
'''
多檔案選擇 檔案大小18MB限制,大于等于 18MB 的詢問是否繼續添加,小于的自動添加
'''
files, fileType = QFileDialog.getOpenFileNames(self, 'select files', './', 'All Files (*)')
for file in files:
# 檔案名
name = os.path.basename(file)
# 檔案大小 MB
size = os.path.getsize(file)
size /= float(1024 ** 2)
if size >= 18:
reply = QMessageBox.warning(self, 'Warning', '{} 大小超出限制,仍要繼續?'.format(name), QMessageBox.Ok | QMessageBox.Cancel)
if reply == QMessageBox.OK:
self.__files.append(file)
else:
self.__files.append(file)
執行時發現
self.__files.append(file)及之后的代碼不會執行,程式退出,Pycharm只顯示
Process finished with exit code -1073740791 (0xC0000409)
不知道要怎么解決問題,請大佬們解惑
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/50952.html
