Skip to content

addAction(self, action: typing.Optional[QAction]): argument 1 has unexpected type 'str'  #8

@ooker777

Description

@ooker777

I install PyQt6 and use this code:

from objbrowser import browse
a = 16; b = 'hello'
browse(locals())

It gives this error:

Traceback (most recent call last):
  File "D:\QC supplements\Code\Apps\Trấn Kỳ\test.py", line 3, in <module>
    browse(locals())
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\__init__.py", line 45, in browse
    ObjectBrowser.browse(*args, **kwargs)     
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 627, in browse        
    cls.create_browser(*args, **kwargs)       
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 598, in create_browser
    object_browser = cls(*args, **kwargs)     
                     ^^^^^^^^^^^^^^^^^^^^     
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 99, in __init__       
    self._setup_menu()
  File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 202, in _setup_menu   
    file_menu.addAction("C&lose", self.close, "Ctrl+W")
TypeError: arguments did not match any overloaded call:
  addAction(self, icon: QIcon, text: Optional[str]): argument 1 has unexpected type 'str'   
  addAction(self, icon: QIcon, text: Optional[str], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'
  addAction(self, icon: QIcon, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int]): argument 1 has unexpected type 'str'
  addAction(self, icon: QIcon, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'  
  addAction(self, text: Optional[str]): too many arguments
  addAction(self, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int]): argument 2 has unexpected type 'builtin_function_or_method'        
  addAction(self, text: Optional[str], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 3 has unexpected type 'str'  addAction(self, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 2 has unexpected type 'builtin_function_or_method'
  addAction(self, action: typing.Optional[QAction]): argument 1 has unexpected type 'str' 

Why is that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions