module ipythonhelper.widgets

Inheritance diagram of pyquickhelper.ipythonhelper.widgets

Short summary

module pyquickhelper.ipythonhelper.widgets

To add interactive widgets in a notebook and connect it to Python function, Source: https://github.com/jakevdp/ipywidgets, the module was modified for Python 3 See notebook Having a form in a notebook.

Copyright (c) 2013, Jake Vanderplas All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the {organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

source on GitHub

Classes

class

truncated documentation

DropDownWidget

drop down list

RadioWidget

radio button

RangeWidget

Range (slider) widget The class overloads html and …

StaticWidget

Base Class for Static Widgets

Methods

method

truncated documentation

__init__

__init__

__init__

__init__

constructor

__repr__

operator, call method html

__repr__

operator, call method html

__repr__

operator, call method html

__repr__

operator, call method html

_repr_html_

operator, call method html

_repr_html_

operator, call method html

_repr_html_

operator, call method html

_repr_html_

operator, call method html

_single_option

private

_single_radio

private

copy

calls deepcopy

copy

calls deepcopy

copy

calls deepcopy

copy

calls deepcopy

html

return HTML string

html

return HTML string

html

HTML code

html

abstract method

renamed

rename name if name is an attribute

renamed

rename name if name is an attribute

renamed

rename name if name is an attribute

renamed

rename name if name is an attribute

values

return all possible values

values

return all the possible values

values

Documentation

To add interactive widgets in a notebook and connect it to Python function, Source: https://github.com/jakevdp/ipywidgets, the module was modified for Python 3 See notebook Having a form in a notebook.

Copyright (c) 2013, Jake Vanderplas All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the {organization} nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

source on GitHub

class pyquickhelper.ipythonhelper.widgets.DropDownWidget(values, name=None, labels=None, default=None, divclass=None, delimiter='      ')[source]

Bases: StaticWidget

drop down list

source on GitHub

Parameters:
  • values – values for the list

  • name – name of the object

  • labels

    ?

  • default – default value

  • divclass – class for div section

  • delimiter – delimiter

source on GitHub

__init__(values, name=None, labels=None, default=None, divclass=None, delimiter='      ')[source]
Parameters:
  • values – values for the list

  • name – name of the object

  • labels

    ?

  • default – default value

  • divclass – class for div section

  • delimiter – delimiter

source on GitHub

_single_option(label, value)[source]

private

source on GitHub

html()[source]

return HTML string

source on GitHub

option_html = '<option value="{value}" {selected}>{label}</option>'[source]

template 2

select_html = '<b>{name}:</b> <select name="{name}" onchange="interactUpdate(this.parentNode);"> {options}</select>'[source]

template 1

values()[source]

return all possible values

source on GitHub

class pyquickhelper.ipythonhelper.widgets.RadioWidget(values, name=None, labels=None, default=None, divclass=None, delimiter='      ')[source]

Bases: StaticWidget

radio button

source on GitHub

Parameters:
  • values – values for the list

  • name – name of the object

  • labels

    ?

  • default – default value

  • divclass – class for div section

  • delimiter – delimiter

source on GitHub

__init__(values, name=None, labels=None, default=None, divclass=None, delimiter='      ')[source]
Parameters:
  • values – values for the list

  • name – name of the object

  • labels

    ?

  • default – default value

  • divclass – class for div section

  • delimiter – delimiter

source on GitHub

_single_radio(value)[source]

private

source on GitHub

html()[source]

return HTML string

source on GitHub

radio_html = '<input type="radio" name="{name}" value="{value}" {checked} onchange="interactUpdate(this.parentNode);">'[source]

template 1

values()[source]

return all the possible values

source on GitHub

class pyquickhelper.ipythonhelper.widgets.RangeWidget(min, max, step=1, name=None, default=None, width=350, divclass=None, show_range=False)[source]

Bases: StaticWidget

Range (slider) widget

The class overloads html and values.

source on GitHub

Parameters:
  • min – min value

  • max – max value

  • step – step

  • name – name

  • default – default value

  • width – width in pixel

  • divclass – class for div section

  • show_range – boolean

source on GitHub

__init__(min, max, step=1, name=None, default=None, width=350, divclass=None, show_range=False)[source]
Parameters:
  • min – min value

  • max – max value

  • step – step

  • name – name

  • default – default value

  • width – width in pixel

  • divclass – class for div section

  • show_range – boolean

source on GitHub

html()[source]

HTML code

Returns:

string HTML

source on GitHub

values()[source]
Returns:

all possible values

source on GitHub

class pyquickhelper.ipythonhelper.widgets.StaticWidget(name=None, divclass=None)[source]

Bases: object

Base Class for Static Widgets

source on GitHub

constructor

Parameters:
  • name – name

  • divclass – class for div section

source on GitHub

__init__(name=None, divclass=None)[source]

constructor

Parameters:
  • name – name

  • divclass – class for div section

source on GitHub

__repr__()[source]

operator, call method html

source on GitHub

_repr_html_()[source]

operator, call method html

source on GitHub

copy()[source]

calls deepcopy

Returns:

copy of self

source on GitHub

html()[source]

abstract method

renamed(name)[source]

rename name if name is an attribute

Returns:

object

source on GitHub