Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ooker777 opened this issue Sep 26, 2023 · 1 comment

Comments

@ooker777
Copy link

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?

@titusjan
Copy link
Owner

objbrowser has not been tested with PyQt6 yet. Best to install PyQt5 if that's possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants