-
Notifications
You must be signed in to change notification settings - Fork 77
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
[兼容性问题] 在python3.10及以上版本 dataclass 的处理方式问题 #203
Comments
Open
请提供报错信息 |
button.py 文件还有几处使用dataclass装饰器的类有类似错误 |
可是我的也是3.10版本,但是正常运行 |
后续应该彻底避免直接构造 QColor 而是使用元数据 |
Python 3.12 同样的报错 |
将所有在 dataclass 里面涉及 QColor 的代码改成这样就行了: from dataclasses import dataclass, field
...
class RadioButtonStyleData(QObject):
STYLE_TYPES = ["Button"]
# text_color = QColor("#D1CBD4")
# description_color = QColor("#918497")
# 替换为 default_factory
text_color: QColor = field(default_factory=lambda: QColor("#D1CBD4"))
description_color: QColor = field(default_factory=lambda: QColor("#918497"))
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在python 3.10及以上版本,直接使用QColor 会导致出现ValueError 运行失败
The text was updated successfully, but these errors were encountered: