button.on_click with parameters
See original GitHub issueIn the example of “Widgets Events” of the ipywidgets doc, I knew that button.on_click can call a function without parameters. But suppose that I define a str variable a, and a function
def fun(a): print(a)
I would like to call this ‘fun’ function when I click the button, but I don’t know how to give the parameter a to the function fun. Thank you for your kind help!
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Pass a string parameter in an onclick function - Stack Overflow
I would like to pass a parameter (i.e. a string) to an Onclick function. with result.name for example equal to string "Add". When...
Read more >Call a function with an argument - W3Schools Tryit Editor
<p>Click "Try it" to call a function with arguments</p> <button onclick="myFunction('Harry Potter','Wizard')">Try it</button> <p id="demo"></p>
Read more >JavaScript | Pass string parameter in onClick function
Example 2: This example simply put the argument which is a string in the onClick attribute of the button which calls a function...
Read more >How To Pass A Parameter Through onClick In React?
Here is how to make it work: Create the first function that accepts the parameter you want to pass and return the second...
Read more >Pass parameter to JavaScript function onclick in HTML
Pass parameter to JavaScript function onclick in HTML | Example code ... It's very easy to Pass parameter to JavaScript function using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
How about calling the
fun
function in theon_button_clicked
function?@rishabhmulani It would be something like this: