See https://github.com/oscar6echo/BlackScholesWidget
This Black Scholes calculator is an attempt to turn a Jupyter notebook into something that looks a bit like a traditional web page. This kind of notebook, coupled with Jupyterhub, enables building and deploying webapps (admittedly limited in terms of UI) simply and fast. This is what I am trying to do in a corporate LAN. In this exemple, I put a relatively complex input form and the results associated within a single composite ipywidget. Then I hide the code cells with a button and offer an 'Init' button (restart kernel & run all cells). So the only thing a user needs to do is click it when the notebook starts. Beyond the official documentation (https://ipywidgets.readthedocs.io/en/latest/index.html) I have seen few examples so far. So I hope it can help people to build simili web apps inside the notebook. Also I would be glad to have to feedback particularly if what I wrote can be improved or does not follow best practises. Here are some remarks / questions about ipywidgets and frontend js derived from this attempt: 1/ I found that the (Bounded)FloatText change event triggers as soon as a single digit changes. As a result, it triggers before you can input a number with several digits. Which can be too often. Example: the case where the FloatText is used to control a max boundary, any change with triggers all observe methods with a single digit number to start with. Is there a way to have more control over what triggers a change event ? For example a 'blur' event on the input box To avoid this unfortunate behavior, I created custom widgets based on HTML input type='number'. Its behavior (and little arrows) is more appropriate, I think, and maybe it could become the default ? I think it would be convenient to have direct access to most possible values of type available in http://www.w3schools.com/tags/att_input_type.asp. One can always create custom widgets to do that, but people won't know what is available, so maybe it could be in the main lib. What do you think ? 2/ Re ipywidgets styling, all widgets have a background_color property but it does not seem to have any styling effect. Should this property be ignored ? More generally, is there a way to pass arbitrary css to the widgets ? To change colors, fonts, etc 3/ Re the list of available widgets, where can I read their python class and javascript code ? Like in the https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Custom.html example, which is very clear. If they are accessible, then it is easy for everyone to make a small variation from a custom widget with a simple copy/paste/adjust. Exemple: I would like to modify the layout of the RadioButton widget to put the name above the radio buttons, not on the left, so as to take less horizontal space. 4/ Can you recommend a concise way to make the 'Init' and 'Show/Hide' code buttons with ipywidgets. As opposed to 'manual javascript', as I have done. 5/ The 'save notebook with snapshot' works partly, it seems. When I reopen the notebook, I get a glimpse of the image soon replaced by some text. In nbviewer, the image appears twice along with the same parasite text. Is this behavior identified ? I am aware that I am asking a lot of questions and that people have little spare time. But I would be grateful for even rough directions or pointers. By the way, I find Jupyter & its ecosystem more and more exciting ! Thx -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/3b50b030-905a-4fa6-a8f2-51aff664ded3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
