Skip to content
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

Calling hide() on a hidden button generates a spurious unhover event #610

Closed
retsyx opened this issue Jun 28, 2024 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@retsyx
Copy link

retsyx commented Jun 28, 2024

Describe the bug
Hiding a button unconditionally generates an unhover event.

To Reproduce
Steps to reproduce the behaviour:

  1. Call hide() on a button
  2. Call hide() again
  3. See unhover event from button

Expected behaviour
Calling hide() on an already hidden button should not generate any incorrect events.

Screenshots

N/A

Platform and software (please complete the following information):

  • OS: Linux
  • Pygame GUI version - latest
  • Pygame version - latest

Additional context

This may apply to other UI elements. Not tested.

This bug forces checking visibility on UI elements before calling hide() to avoid triggering these incorrect events.

@retsyx retsyx added the bug Something isn't working label Jun 28, 2024
@rbaltrusch
Copy link
Contributor

Hi @MyreMylar, could you assign me this issue and review my PR? It should fix this issue for all widgets in the code base.

However, in my opinion, there is a related and more complicated issue here that I am not fixing with this PR that might need additional work: the method on_unhovered can get called without the hovered state actually being set (due to that state being independently handled outside of that method), which partially leads to the issue described here. It would make more sense to not be able to unhover if already unhovered.

MyreMylar added a commit that referenced this issue Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants