app reboots instead of updates (and all buttons require two clicks)

I implemented a toy example based on stock_app.py:

What is supposed to happen:

  1. Click the “Select plot criteria” button to reveal a “Submit” button and a Select widget.

  2. Select a number from the Select widget…

  3. Click the “Submit” button to show the selected number in a Paragraph widget.

  4. (Optional) Click the “Cancel” button (which is just the re-labelled “Select plot criteria” button) to hide the “Submit” button and Select widget.

What actually happens:

  1. Click the “Select plot criteria” and nothing happens.

  2. Click the “Select plot criteria” a to reveal a “Submit” button and a Select widget.

  3. Select a number from the Select widget.

  4. Click the “Submit” button, at which point the entire app seems to reboot to its original state.

  5. (Optional) Click the “Cancel” button to hide the “Submit” button and Select widget but nothing happens.

  6. (Optional) Click the “Cancel” button again to actually hide the “Submit” button and Select widget.

Questions:

  1. Why do I have to click my buttons twice in order to get them to work?

  2. Why does the submit_menu callback on my “Submit” button, which just sets the Paragraph text and toggles the menu, restart the entire app?

This clearly doesn’t happen on the stock_app.py example, any while that example doesn’t involve the hiding of input widgets, it seems safe to assume this is a problem with my code. Can anyone help?

Hi Schaun,

Sorry, I just commented on another post regarding the issue with button re-creating the app. :slight_smile:

For what concerns updating the interface on events, I’ve commented on the other thread. Regarding the button even oddities (and related 1 and 2 questions), I’ve opened a GH Issue as it’s likely to be a bug.

Thank you

Fabio

···

On Tuesday, April 28, 2015 at 9:11:20 PM UTC+2, Schaun Wheeler wrote:

I implemented a toy example based on stock_app.py:

https://gist.github.com/schaunwheeler/ac1162db95d13a0a5070

What is supposed to happen:

  1. Click the “Select plot criteria” button to reveal a “Submit” button and a Select widget.
  1. Select a number from the Select widget…
  1. Click the “Submit” button to show the selected number in a Paragraph widget.
  1. (Optional) Click the “Cancel” button (which is just the re-labelled “Select plot criteria” button) to hide the “Submit” button and Select widget.

What actually happens:

  1. Click the “Select plot criteria” and nothing happens.
  1. Click the “Select plot criteria” a to reveal a “Submit” button and a Select widget.
  1. Select a number from the Select widget.
  1. Click the “Submit” button, at which point the entire app seems to reboot to its original state.
  1. (Optional) Click the “Cancel” button to hide the “Submit” button and Select widget but nothing happens.
  1. (Optional) Click the “Cancel” button again to actually hide the “Submit” button and Select widget.

Questions:

  1. Why do I have to click my buttons twice in order to get them to work?
  1. Why does the submit_menu callback on my “Submit” button, which just sets the Paragraph text and toggles the menu, restart the entire app?

This clearly doesn’t happen on the stock_app.py example, any while that example doesn’t involve the hiding of input widgets, it seems safe to assume this is a problem with my code. Can anyone help?