wxyz.html

Widgets for core HTML 5 controls

class wxyz.html.AlphaColor(default_value=traitlets.Undefined, allow_none=False, read_only=None, help=None, config=None, **kwargs)[source]

Bases: ipywidgets.widgets.trait_types.Color

A color with alpha

__get__(obj, cls=None)

Get the value of the trait by self.name for the instance.

Default values are instantiated when HasTraits.__new__() is called. Thus by the time this method gets called either the default value or a user defined value (they called __set__()) is in the HasTraits instance.

__set__(obj, value)

Set the value of the trait by self.name for the instance.

Values pass through a validation stage where errors are raised when impropper types, or types that cannot be coerced, are encountered.

class_init(cls, name)

Part of the initialization which may depend on the underlying HasDescriptors class.

It is typically overloaded for specific types.

This method is called by MetaHasDescriptors.__init__() passing the class (cls) and name under which the descriptor has been assigned.

default(obj=None)

The default generator for this trait

Notes

This method is registered to HasTraits classes during class_init in the same way that dynamic defaults defined by @default are.

default_value = traitlets.Undefined
error(obj, value, error=None, info=None)

Raise a TraitError

Parameters
  • obj (HasTraits or None) – The instance which owns the trait. If not object is given, then an object agnostic error will be raised.

  • value (any) – The value that caused the error.

  • error (Exception (default: None)) – An error that was raised by a child trait. The arguments of this exception should be of the form (value, info, *traits). Where the value and info are the problem value, and string describing the expected value. The traits are a series of TraitType instances that are “children” of this one (the first being the deepest).

  • info (str (default: None)) – A description of the expected value. By default this is infered from this trait’s info method.

from_string(s)

Get a value from a config string

such as an environment variable or CLI arguments.

Traits can override this method to define their own parsing of config strings.

See also

item_from_string

New in version 5.0.

get_default_value()

DEPRECATED: Retrieve the static default value for this trait. Use self.default_value instead

get_metadata(key, default=None)

DEPRECATED: Get a metadata value.

Use .metadata[key] or .metadata.get(key, default) instead.

init_default_value(obj)

DEPRECATED: Set the static default value for the trait type.

instance_init(obj)

Part of the initialization which may depend on the underlying HasDescriptors instance.

It is typically overloaded for specific types.

This method is called by HasTraits.__new__() and in the BaseDescriptor.instance_init() method of descriptors holding other descriptors.

set_metadata(key, value)

DEPRECATED: Set a metadata key/value.

Use .metadata[key] = value instead.

tag(**metadata)

Sets metadata and returns self.

This allows convenient metadata tagging when initializing the trait, such as:

>>> Int(0).tag(config=True, sync=True)
validate(obj, value)[source]

expand the validation to work for rgba

class wxyz.html.AlphaColorPicker(**kwargs)[source]

Bases: ipywidgets.widgets.widget_color.ColorPicker

A color picker that should allow setting opacity

get_interact_value()

Return the value for this widget which should be passed to interactive functions. Custom widgets can change this method to process the raw value self.value.

class wxyz.html.EmptyAlphaColor(default_value=traitlets.Undefined, allow_none=False, read_only=None, help=None, config=None, **kwargs)[source]

Bases: ipywidgets.widgets.trait_types.Color

A color with alpha that might be the empty string

__get__(obj, cls=None)

Get the value of the trait by self.name for the instance.

Default values are instantiated when HasTraits.__new__() is called. Thus by the time this method gets called either the default value or a user defined value (they called __set__()) is in the HasTraits instance.

__set__(obj, value)

Set the value of the trait by self.name for the instance.

Values pass through a validation stage where errors are raised when impropper types, or types that cannot be coerced, are encountered.

class_init(cls, name)

Part of the initialization which may depend on the underlying HasDescriptors class.

It is typically overloaded for specific types.

This method is called by MetaHasDescriptors.__init__() passing the class (cls) and name under which the descriptor has been assigned.

default(obj=None)

The default generator for this trait

Notes

This method is registered to HasTraits classes during class_init in the same way that dynamic defaults defined by @default are.

default_value = traitlets.Undefined
error(obj, value, error=None, info=None)

Raise a TraitError

Parameters
  • obj (HasTraits or None) – The instance which owns the trait. If not object is given, then an object agnostic error will be raised.

  • value (any) – The value that caused the error.

  • error (Exception (default: None)) – An error that was raised by a child trait. The arguments of this exception should be of the form (value, info, *traits). Where the value and info are the problem value, and string describing the expected value. The traits are a series of TraitType instances that are “children” of this one (the first being the deepest).

  • info (str (default: None)) – A description of the expected value. By default this is infered from this trait’s info method.

from_string(s)

Get a value from a config string

such as an environment variable or CLI arguments.

Traits can override this method to define their own parsing of config strings.

See also

item_from_string

New in version 5.0.

get_default_value()

DEPRECATED: Retrieve the static default value for this trait. Use self.default_value instead

get_metadata(key, default=None)

DEPRECATED: Get a metadata value.

Use .metadata[key] or .metadata.get(key, default) instead.

init_default_value(obj)

DEPRECATED: Set the static default value for the trait type.

instance_init(obj)

Part of the initialization which may depend on the underlying HasDescriptors instance.

It is typically overloaded for specific types.

This method is called by HasTraits.__new__() and in the BaseDescriptor.instance_init() method of descriptors holding other descriptors.

set_metadata(key, value)

DEPRECATED: Set a metadata key/value.

Use .metadata[key] = value instead.

tag(**metadata)

Sets metadata and returns self.

This allows convenient metadata tagging when initializing the trait, such as:

>>> Int(0).tag(config=True, sync=True)
validate(obj, value)[source]

expand the validation to work for rgba

class wxyz.html.File(**kwargs)[source]

Bases: wxyz.html.base.HTMLBase

A file. Might be uploaded from the browser.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

proxy(klass, **kwargs)[source]

Generate a Proxy file object, given a File-compatible class

class wxyz.html.FileBox(**kwargs)[source]

Bases: wxyz.html.base.HTMLBase, ipywidgets.widgets.widget_box.Box

A box of files, which can be used to upload and download files

class wxyz.html.Fullscreen(**kwargs)[source]

Bases: wxyz.html.base.HTMLBase, ipywidgets.widgets.widget_box.Box

A full-screen Box, activated with Ctrl+Shift+Click, or the flower key on MacOS

class wxyz.html.JSONFile(**kwargs)[source]

Bases: wxyz.html.widget_file.File

A JSON file

proxy(klass, **kwargs)

Generate a Proxy file object, given a File-compatible class

class wxyz.html.TextFile(**kwargs)[source]

Bases: wxyz.html.widget_file.File

A Text file

proxy(klass, **kwargs)

Generate a Proxy file object, given a File-compatible class

Classes

digraph "classes_html" { graph [fontname = "sans-serif"]; node [fontname = "sans-serif"]; edge [fontname = "sans-serif"]; charset="utf-8" rankdir=BT "0" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/base.py.HTMLBase|_model_module\l_model_module_version\l_view_module\l_view_module_version\l|}", shape="record"]; "1" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_color.py.AlphaColor|\l|validate(obj, value)\l}", shape="record"]; "2" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_color.py.AlphaColorPicker|value\l|}", shape="record"]; "3" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_color.py.EmptyAlphaColor|\l|validate(obj, value)\l}", shape="record"]; "4" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_file.py.File|_model_name\l_view_name\llast_modified\lmime_type\lname\lsize\lvalue\l|proxy(klass)\l}", shape="record"]; "5" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_file.py.FileBox|_model_name\l_view_name\laccept\lchildren\lmultiple\l|}", shape="record"]; "6" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_file.py.JSONFile|_model_name\ljson\ljson\lsize\lvalue : str\l|__init__()\l_on_bytes(change)\l_on_json(change)\l}", shape="record"]; "7" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_file.py.TextFile|_model_name\lencoding\lsize\ltext\ltext\lvalue\l|__init__()\l_on_bytes(change)\l_on_text(change)\l}", shape="record"]; "8" [label="{/home/runner/work/wxyz/wxyz/envs/_base/lib/python3.8/site-packages/wxyz/html/widget_fullscreen.py.Fullscreen|_model_name\l_view_name\l|}", shape="record"]; "9" [label="{ipywidgets.widgets.domwidget.DOMWidget|_dom_classes\l_dom_classes\l_model_name\llayout\l|_repr_keys()\ladd_class(className)\lremove_class(className)\l}", shape="record"]; "10" [label="{ipywidgets.widgets.trait_types.Color|default_value : Sentinel\linfo_text : str\l|validate(obj, value)\l}", shape="record"]; "11" [label="{ipywidgets.widgets.valuewidget.ValueWidget|value : Any\l|_repr_keys()\lget_interact_value()\l}", shape="record"]; "12" [label="{ipywidgets.widgets.widget.LoggingHasTraits|log : Instance\l|_log_default()\l}", shape="record"]; "13" [label="{ipywidgets.widgets.widget.Widget|_display_callbacks : Instance\l_holding_sync : bool\l_holding_sync : bool\l_ipython_display_ : NoneType\l_model_id\l_model_module\l_model_module_version\l_model_name\l_msg_callbacks : Instance\l_property_lock : Dict\l_property_lock : dict\l_states_to_send : Set\l_view_count : Int\l_view_module\l_view_module_version\l_view_name\l_widget_construction_callback : NoneType\lcomm : Comm, NoneType\lcomm : Instance\lkeys : List\lmodel_id\lwidget_types : WidgetRegistry\lwidgets : dict\l|__del__()\l__init__()\l__repr__()\l_call_widget_constructed(widget)\l_comm_changed(change)\l_compare(a, b)\l_default_keys()\l_gen_repr_from_keys(keys)\l_get_embed_state(drop_defaults)\l_handle_custom_msg(content, buffers)\l_handle_displayed()\l_handle_msg(msg)\l_ipython_display_()\l_is_numpy(x)\l_lock_property()\l_repr_keys()\l_send(msg, buffers)\l_should_send_property(key, value)\l_trait_from_json(x)\l_trait_to_json(x)\ladd_traits()\lclose()\lclose_all(cls)\lget_manager_state(drop_defaults, widgets)\lget_state(key, drop_defaults)\lget_view_spec()\lhandle_comm_opened(comm, msg)\lhold_sync()\lnotify_change(change)\lon_displayed(callback, remove)\lon_msg(callback, remove)\lon_widget_constructed(callback)\lopen()\lsend(content, buffers)\lsend_state(key)\lset_state(sync_data)\l}", shape="record"]; "14" [label="{ipywidgets.widgets.widget_color.ColorPicker|_model_name\l_view_name\lconcise : Bool\ldisabled : Bool\lvalue\l|}", shape="record"]; "15" [label="{ipywidgets.widgets.widget_core.CoreWidget|_model_module\l_model_module_version\l_view_module\l_view_module_version\l|}", shape="record"]; "16" [label="{ipywidgets.widgets.widget_description.DescriptionWidget|_model_name\ldescription\ldescription_tooltip\lstyle\l|_repr_keys()\l}", shape="record"]; "17" [label="{traitlets.traitlets.BaseDescriptor|name\lname : NoneType\lthis_class\lthis_class : NoneType\l|class_init(cls, name)\linstance_init(obj)\lsubclass_init(cls)\l}", shape="record"]; "18" [label="{traitlets.traitlets.HasDescriptors|\l|__new__()\lsetup_instance()\l}", shape="record"]; "19" [label="{traitlets.traitlets.HasTraits|__class__\l__dict__\l_cross_validation_lock : bool\l_trait_notifiers : dict\lcross_validation_lock\lnotify_change\l|__getstate__()\l__init__()\l__setstate__(state)\l_add_notifiers(handler, name, type)\l_get_trait_default_generator(name)\l_notify_observers(event)\l_notify_trait(name, old_value, new_value)\l_register_validator(handler, names)\l_remove_notifiers(handler, name, type)\ladd_traits()\lclass_own_trait_events(cls, name)\lclass_own_traits(cls)\lclass_trait_names(cls)\lclass_traits(cls)\lhas_trait(name)\lhold_trait_notifications()\lnotify_change(change)\lobserve(handler, names, type)\lon_trait_change(handler, name, remove)\lset_trait(name, value)\lsetup_instance()\ltrait_defaults()\ltrait_events(cls, name)\ltrait_has_value(name)\ltrait_metadata(traitname, key, default)\ltrait_names()\ltrait_values()\ltraits()\lunobserve(handler, names, type)\lunobserve_all(name)\l}", shape="record"]; "20" [label="{traitlets.traitlets.TraitType|allow_none : bool\lallow_none : bool\ldefault_value : Sentinel\ldefault_value : Sentinel\lhelp : NoneType, str\linfo_text : str\lmetadata : dict\lmetadata : dict\lread_only : NoneType\lread_only : bool\l|__get__(obj, cls)\l__init__(default_value, allow_none, read_only, help, config)\l__or__(other)\l__set__(obj, value)\l_cross_validate(obj, value)\l_validate(obj, value)\ldefault(obj)\ldefault_value_repr()\lerror(obj, value, error, info)\lfrom_string(s)\lget(obj, cls)\lget_default_value()\lget_metadata(key, default)\linfo()\linit_default_value(obj)\lset(obj, value)\lset_metadata(key, value)\ltag()\l}", shape="record"]; "21" [label="{traitlets.traitlets.Unicode|default_value : str\linfo_text : str\l|from_string(s)\lvalidate(obj, value)\l}", shape="record"]; "22" [label="{wxyz.core.base.Base|_model_module\l_model_module_version\l_view_module\l_view_module_version\lclosable : Bool\ldescription\lerror : CUnicode\licon_class\l|}", shape="record"]; "23" [label="{wxyz.core.base.WXYZBase|_model_module\l_model_module_version\l_view_module\l_view_module_version\l|}", shape="record"]; "0" -> "22" [arrowhead="empty", arrowtail="none"]; "1" -> "10" [arrowhead="empty", arrowtail="none"]; "2" -> "14" [arrowhead="empty", arrowtail="none"]; "3" -> "10" [arrowhead="empty", arrowtail="none"]; "6" -> "4" [arrowhead="empty", arrowtail="none"]; "7" -> "4" [arrowhead="empty", arrowtail="none"]; "9" -> "13" [arrowhead="empty", arrowtail="none"]; "10" -> "21" [arrowhead="empty", arrowtail="none"]; "11" -> "13" [arrowhead="empty", arrowtail="none"]; "12" -> "19" [arrowhead="empty", arrowtail="none"]; "13" -> "12" [arrowhead="empty", arrowtail="none"]; "14" -> "11" [arrowhead="empty", arrowtail="none"]; "14" -> "15" [arrowhead="empty", arrowtail="none"]; "14" -> "16" [arrowhead="empty", arrowtail="none"]; "15" -> "13" [arrowhead="empty", arrowtail="none"]; "16" -> "9" [arrowhead="empty", arrowtail="none"]; "16" -> "15" [arrowhead="empty", arrowtail="none"]; "19" -> "18" [arrowhead="empty", arrowtail="none"]; "20" -> "17" [arrowhead="empty", arrowtail="none"]; "21" -> "20" [arrowhead="empty", arrowtail="none"]; "22" -> "23" [arrowhead="empty", arrowtail="none"]; "23" -> "13" [arrowhead="empty", arrowtail="none"]; "21" -> "0" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module", style="solid"]; "21" -> "0" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module_version", style="solid"]; "21" -> "0" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module", style="solid"]; "21" -> "0" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module_version", style="solid"]; "21" -> "9" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_name", style="solid"]; "21" -> "13" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_name", style="solid"]; "21" -> "13" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module", style="solid"]; "21" -> "13" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module_version", style="solid"]; "21" -> "13" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_name", style="solid"]; "21" -> "13" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module", style="solid"]; "21" -> "13" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module_version", style="solid"]; "21" -> "14" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_name", style="solid"]; "21" -> "14" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_name", style="solid"]; "21" -> "15" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module", style="solid"]; "21" -> "15" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module_version", style="solid"]; "21" -> "15" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module", style="solid"]; "21" -> "15" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module_version", style="solid"]; "21" -> "16" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_name", style="solid"]; "21" -> "16" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="description", style="solid"]; "21" -> "16" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="description_tooltip", style="solid"]; "21" -> "22" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module", style="solid"]; "21" -> "22" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module_version", style="solid"]; "21" -> "22" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module", style="solid"]; "21" -> "22" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module_version", style="solid"]; "21" -> "22" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="description", style="solid"]; "21" -> "22" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="icon_class", style="solid"]; "21" -> "23" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module", style="solid"]; "21" -> "23" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_model_module_version", style="solid"]; "21" -> "23" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module", style="solid"]; "21" -> "23" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_view_module_version", style="solid"]; }