Replies: 1 comment
-
Thanks, it will be adjusted. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the process of implementing my mini-application, it was necessary to create a drag-target object. The linter started complaining that the event source (event.src_id) is a float, while the page.get_control() method expects an int as input. Upon closer examination, I discovered that src_id accepts string values and that there is a typo in the implementation of the DragTargetEvent and DragTargetAcceptEvent classes.
`
class DragTargetAcceptEvent(ControlEvent):
def init(self, e: ControlEvent):
super().init(e.target, e.name, e.data, e.control, e.page)
d = json.loads(e.data)
warn(
f"{self.class.name} is deprecated since version 0.22.0 "
f"and will be removed in version 0.26.0. Use DragTargetEvent instead.",
category=DeprecationWarning,
stacklevel=2,
)
self.src_id: float = d["src_id"]
self.x: float = d["x"]
self.y: float = d["y"]
class DragTargetEvent(ControlEvent):
def init(self, e: ControlEvent):
super().init(e.target, e.name, e.data, e.control, e.page)
d = json.loads(e.data)
self.src_id: float = d["src_id"]
self.x: float = d["x"]
self.y: float = d["y"]
`
Beta Was this translation helpful? Give feedback.
All reactions