solution: All subclasses of LocationEvent could be used in cbook.callbacks before being fully initialized - issue 15139#16948
Conversation
|
@anntzer I don't think this collides with #16931 (which will fix the same bug by not doing the processing in Thanks for this @Stefan-Mitic ! It looks like there are a couple of un-related commits on this branch. Could you please remove them? See https://matplotlib.org/devel/gitwash/development_workflow.html?highlight=rebase#rewriting-commit-history for instructions. Remember that when you push the re-written branch to github to not do what it suggests about merging and instead use |
|
I can handle the rebase, sure. |
4543d48 to
d99430e
Compare
Thanks for the help @tacaswell |
|
So if I read #15139 correctly, the same thing should be done for |
|
Yes @QuLogic, I added it to |
|
Can you add tests? I think it should work in |
timhoffm
left a comment
There was a problem hiding this comment.
In both cases, there should be a comment why the super-init call is deferred to the end. Usually it's in the first line and there's a danger that people will move it back later, or at least are confused why it's at the end.
|
@QuLogic, I'm not sure how to trigger a keypress event to invoke my callback function. |
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
I don't disagree, but we have the event system we have. With |
…nt could be used in cbook.callbacks before being fully initialized - issue 15139
…948-on-v3.2.x Backport PR #16948 on branch v3.2.x (solution: All subclasses of LocationEvent could be used in cbook.callbacks before being fully initialized - issue 15139)
PR Summary
Modified the call to LocationEvent.init() to be after MouseButton initialization in MouseEvent.init(). The reason for this is the error occurs because callback.process is invoked before the initialization.
MouseEvent is a subclass of LocationEvent, so it is safe to say that motion_notify_event() can be called by a child class of LocationEvent.
Issue Ref: #15139
PR Checklist