#Matplotlib mencoder windows 10 update#
updating slider 1 would update slider 2, but not the other way around.
There are also a dlink and jslink function doing a similar thing. In this way, when we change the value of the first, the minimum value of the second is updated correspondingly. In the example below, value on the first slider is connected to min on the second. This function takes two tuples of the form (widget, trait) and links the given traits of the given widgets. Widgets can also be linked together using the link function. Int_slider = widgets.IntSlider(value=7, min=0, max=10) mousebutton release, enter), and not on every value traversed along the way. This option, also available in other widgets, makes sure the callback is only called when making changes is done (e.g. Note the continuous_update option when creating the IntSlider. The next cell shows an example, where the frequency of a sine is connected to a slider. The value property of a widget is such a trait, meaning we can use observe to connect a callback function, which will get called every time value changes. To look into this in further detail, check out the traitlets library. Traits are special properties that come from a parent class called HasTraits. This example shows how we can use the observe method to connect a function to a widget trait.
Below, we show an example of an application similar to the one above: a sine and a slider (just the one this time). # a VBox container to pack widgets verticallyĪs before, making and displaying widgets is great, but putting them to work is awesome.
Int_range_slider = widgets.IntRangeSlider( The indent can be removed by passing the argument indent=False.Ī personal favorite is the combobox at the end, which starts showing a list of matching possibilities as one starts typing. Checkboxes are displayed a little differently with their description on the right, but still indented. RadioButtons allow the selection of single value from a list of options, similar to the dropdown list. The IntRangeSlider is like an IntSlider, but as the name implies, it allows the selection of an lower and upper bound of a range. The cell below shows a few common selection widgets, some of which we met before. # show the three together in a VBox (vertical box container)
We also import some libraries: matplotlib for plotting, NumPy to generate data, and ipywidgets for obvious reasons. We do this using a magic command, starting with %. To get started, we set the ipympl backend, which makes matplotlib plots interactive. The versions of packages explicitly used to create the examples are:
#Matplotlib mencoder windows 10 windows 10#
The examples were tested on Windows 10 and Arch Linux. Therefore, if you have problems displaying plots correctly, try using pip only, or Linux. Anaconda currently has a matplotlib issue that gives some problems (at least on Windows 10). Note that for this tutorial, all libraries were installed using pip, or the pacman package manager. Setting up an installation lies outside the scope of the tutorial, but can be found in the official docs. To run the notebook locally, the very first requirement is a working Jupyter environment. The notebook used for this tutorial is available on github, together with a link to a live version on binder.