pyqt5 TypeError: getOpenFileName(parent: QWidget = None, caption: str = ”【解决办法】

今天爱分享给大家带来pyqt5 TypeError: getOpenFileName(parent: QWidget = None, caption: str = ”, directory: str = ”, fil【解决办法】,希望能够帮助到大家。

今天在用pyqt5打开文件的时候,出现了下面的错误:

Traceback (most recent call last):
  File "/Users/admin/PycharmProjects/test_qt/src/tooth.py", line 20, in openimage
    imgName, imgType = QFileDialog.getOpenFileName( '选择文件', '', "*.jpg;;*.png;;All Files(*)")
TypeError: getOpenFileName(parent: QWidget = None, caption: str = '', directory: str = '', filter: str = '', initialFilter: str = '', options: Union[QFileDialog.Options, QFileDialog.Option] = 0): argument 1 has unexpected type 'str'

解决方法

imgName, imgType = QFileDialog.getOpenFileName(None,'选择文件','',"*.jpg;;*.png;;All Files(*)")

人已赞赏
Python

python3如何用 json读取和写入带中文的文件【附代码】

2020-11-14 22:58:15

Python

pyrouge No such file or directory: 'yourpath/.pyrouge/settings.ini'【解决办法】

2020-11-14 23:35:34

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
'); })();