Python Pyqt6对方法参数感到困惑 - >联合[QBrush,QColor,GlobalColor,INT,QGRADIENT]
我遇到了几种要求建立工会的方法。例如此setForeground(union [qbrush,qcolor,Qcolor,globalColor,int,qgradient]))
from qstandardItem
和此backgroundbrush:union [qbrush,qbrush,qcolor,qcolor,qcolor,int int,int int int ,qgradient]
来自qStyleOptionView
。还有其他。
我没有代码可以共享,因为我还没有达到这一点。我不明白这个论点。我的IDE说我需要传递typing.union
,但这是这样说的文档,说两个参数
那么,有人可以给我一个如何成功通过该论点的例子吗?谢谢。
I have a couple of methods I've come across that ask for a Union. Such as this setForeground(Union[QBrush, QColor, GlobalColor, int, QGradient])
from QStandardItem
and this backgroundBrush: Union[QBrush, QColor, GlobalColor, int, QGradient]
from QStyleOptionView
. There are others.
I don't have code to share because I have not got to that point yet. I don't understand that argument. My IDE says that I need to pass a typing.Union
, but the docs for that say it takes two parameters Python typing docs. "To define a union, use e.g. Union[int, str] or the shorthand int | str. Using that shorthand is recommended."
So, can someone give me an example of how to successfully pass that argument? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论