-
Notifications
You must be signed in to change notification settings - Fork 454
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
ValueError: mutable default <class 'flet.alignment.Alignment'> for field begin is not allowed: use default_factory #173
Comments
Thanks for reporting that! Could you please try replacing |
This explains an issue more: I'm not sure why it's not reproducible with Python 3.10, but definitely it looks like a bug. |
I've made the following modifications inside @dataclasses.dataclass
class LinearGradient(Gradient):
# begin: Alignment = field(default=alignment.center_left)
begin: Alignment = field(default_factory=alignment.center_left)
# end: Alignment = field(default=alignment.center_right)
end: Alignment = field(default_factory=alignment.center_right)
type: str = field(default="linear")
@dataclasses.dataclass
class RadialGradient(Gradient):
# center: Alignment = field(default=alignment.center)
center: Alignment = field(default_factory=alignment.center)
radius: Union[float, int] = field(default=0.5)
focal: Alignment = field(default=None)
focal_radius: Union[float, int] = field(default=0.0)
type: str = field(default="radial")
@dataclasses.dataclass
class SweepGradient(Gradient):
# center: Alignment = field(default=alignment.center)
center: Alignment = field(default_factory=alignment.center)
start_angle: Union[float, int] = field(default=0.0)
end_angle: Union[float, int] = field(default=math.pi * 2)
type: str = field(default="sweep") |
So, it's been fixed in https://pypi.org/project/flet/0.1.49/ - please update |
Context:
Ubuntu 21.10
flet 0.1.48
Python 3.11.0b4
I was trying to follow the introduction and I received this traceback:
Is there something I'm doing correctly ?
The only Python class with an attribute named begin is here. If there is really a bug somewhere, is there anything I can do to help you fix this ?
o/
The text was updated successfully, but these errors were encountered: