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

Listeners functions do not catch their trigger if the widget is not fully loaded #63

Closed
ManonMarchand opened this issue Jun 6, 2023 · 3 comments · Fixed by #107
Closed
Labels
Milestone

Comments

@ManonMarchand
Copy link
Member

What happens

Sometimes, the widget has not finished loading when the user attempts to call one of the listeners functions (add_table, target...)
This can be trigered in two ways:

  • users call the listeners in the same cells than the widget
  • use of automatic executions of cells (like in testing or regeneration tools)

Possible ideas for fixes

  • Implement an await on python side or async on javascript side?
  • Rework the way we handle listenners
@ManonMarchand ManonMarchand added this to the 1.0.0 milestone Jun 6, 2023
@ManonMarchand ManonMarchand changed the title Listenners functions Listeners functions do not catch their trigger if the widget is not fully loaded Jun 6, 2023
@ManonMarchand
Copy link
Member Author

Refer to this doc for the choice of the solution : https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Low%20Level.html

@ManonMarchand
Copy link
Member Author

Update: await on python side is a dead end.

@ManonMarchand
Copy link
Member Author

Update2: doing the flag change in a thread as suggested here https://ipywidgets.readthedocs.io/en/7.6.5/examples/Widget%20Asynchronous.html did not work neither

import threading
thread = threading.Thread(target=exec, args=("self.update_wcs_flag = not self.update_wcs_flag", {'self': self}))
thread.daemon = True
thread.start()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant