Create new button from on_click() method OR create 2nd button during 1st button press event
See original GitHub issueI am trying to create a button run time. Example, On click ‘Load’ button, create ‘Test’ button. How do I achieve this feature in widgets? ‘’‘Code here’‘’
from ipywidgets import Button
def mycallbackk(b):
btn1=Button(description='test')
display(btn1)
pass
btn = Button(description='Load')
btn.on_click(mycallbackk)
display(btn)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
HTML Button onclick – JavaScript Click Event Tutorial
In this tutorial, we are going to explore the two different ways of executing click events in JavaScript using two different methods. First...
Read more >Call two functions from same onclick [duplicate] - Stack Overflow
You can create a single function that calls both of those, and then use it in the event.
Read more >onclick Event - W3Schools
onmousedown, A mouse button is pressed over an element ... In JavaScript, using the addEventListener() method: object. ... Use onclick to create a...
Read more >How to Use the JavaScript onClick Event: A Step-by-Step Guide
First, you must select the element to which you want to add the onClick event. For our button example, we would use the...
Read more >Handling Click events in Button | Android - GeeksforGeeks
When the user clicks a button, the Button object receives an on-click event. To make click event work add android:onClick attribute to the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for following up with a solution!
As a tip, enclose code in three backticks to have it formatted nicely (I edited your comment so you can see how to do it).
“Alternatively, you could create a hbox at the global level, and in the callback add the button to the hbox, which would then automatically display it.”
Thanks, @jasongrout , your 2nd method works.
Here is the code: