Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mwcraig/ipywidgets-examples
A short example illustrating how to build a pure-python jupyter widget
https://github.com/mwcraig/ipywidgets-examples
ipywidgets jupyter-widget
Last synced: 20 days ago
JSON representation
A short example illustrating how to build a pure-python jupyter widget
- Host: GitHub
- URL: https://github.com/mwcraig/ipywidgets-examples
- Owner: mwcraig
- License: bsd-3-clause
- Created: 2016-11-12T15:21:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-20T17:01:05.000Z (over 7 years ago)
- Last Synced: 2024-12-06T06:25:13.089Z (3 months ago)
- Topics: ipywidgets, jupyter-widget
- Language: Python
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Jupyter widget example
This is intended as a straightforward example of how to build a pure-python widget that uses a Model-View-Controller design. It works with [ipywidgets](http://ipywidgets.readthedocs.io/en/latest/index.html) `5+` and [traitlets](http://traitlets.readthedocs.io/en/stable/) `4.1+`. This is not currently packaged for installation via pypi. Instead, download it as a zip from github, or, even better, clone it and improve it!
The widget is a simple password generator.
The file `model.py` contains the data model: a class that has as [traitlet](http://traitlets.readthedocs.io/en/stable/) properties the parameters that go into generating the password and a method for doing the generation based on the parameters. The `observe` decorator indicates which method gets called when properties of the widgets change because the user has adjusted them; this is one piece of the controller.
The file `gui.py` does two things: set up the actual widgets (the view) and link properties of the widget elements to traits in the model (one piece of the controller).