We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Attempting to send certain kwargs to QMessageBox will exception, while the stubs say it does support it. For example:
filepath_str, _filter = QFileDialog.getSaveFileName(self, "Save As", "", self._saveFilter, "") if not filepath_str or not filepath_str.strip() or not os.path.exists(filepath_str): QMessageBox( icon=QMessageBox.Critical, title="Failed to add resource", text=f"Could not add resource at {filepath_str}: Choose a valid file.", parent=None, flags=Qt.Window | Qt.Dialog | Qt.WindowStaysOnTopHint, ).exec_()
The above code fails on PyQt5 but mypy does not catch it. The following works however:
filepath_str, _filter = QFileDialog.getSaveFileName(self, "Save As", "", self._saveFilter, "") if not filepath_str or not filepath_str.strip() or not os.path.exists(filepath_str): QMessageBox( QMessageBox.Critical, "Failed to add resource", f"Could not add resource at {filepath_str}: Choose a valid file.", parent=None, flags=Qt.Window | Qt.Dialog | Qt.WindowStaysOnTopHint, ).exec_()
The text was updated successfully, but these errors were encountered:
Python 3.8 supports function sigs like this:
def my_function(arg1, arg2, /, arg3): ...
if you need to support older Python versions, just use a sys.version_info check for < 3.8, and just prefix the title and text args with __
__
Probably a better way to do this but that's just off the top of my head.
Sorry, something went wrong.
No branches or pull requests
Attempting to send certain kwargs to QMessageBox will exception, while the stubs say it does support it. For example:
The above code fails on PyQt5 but mypy does not catch it. The following works however:
The text was updated successfully, but these errors were encountered: