Skip to main content

ipywidgets_toggle_buttons

GitHub last commit GitHub license<space><space> Documentation Status PyPI PyPI - Python Version

Short Overview.

ipywidgets_toggle_buttons is a simple python package(py>=3.6) with more toggle buttons for ipywidgets

Installation via pip:

pip install ipywidgets_toggle_buttons

Long Overview.

This python package consists of other ToggleButtons classes

  • ToggleButtonsAutoSize - To adjust buttons size to show their’s full description automatically

  • MultiToggleButtons - To select a few options at once with usual ToggleButtons interface

  • ToggleButtonsWithHide - ToggleButtonsAutoSize + Hidden options

  • MultiToggleButtonsWithHide - MultiToggleButtons + Hidden options

All of them will adjust size of buttons if options are modified.
Also they have usual interfaces to work with values and options

Usage examples

ToggleButtonsAutoSize

Create and show this widget

from ipywidgets_toggle_buttons import ToggleButtonsAutoSize
wid = ToggleButtonsAutoSize(options=[str(i) for i in range(10)])
wid
images/toggle_buttons_auto_size_1.JPG
print(wid.value)  # "0"
print(wid.options)  # ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
print(wid.layout.width)  # '100%'
wid.options = list(wid.options) + ["ajhfkaghnkandjgnakdn"]
images/toggle_buttons_auto_size_2.JPG

MultiToggleButtons

Create and show this widget

from ipywidgets_toggle_buttons import MultiToggleButtons
wid = MultiToggleButtons(
    options=[str(i) for i in range(10)],
    max_chosen_values=2,
)
wid
images/multi_toggle_buttons_1.JPG
def on_value_change(_):
    print("pew")

wid.observe(on_value_change, 'value')
print(wid.value)  # ()
wid.value = ["2", "8"]  # "pew"
images/multi_toggle_buttons_2.JPG

ToggleButtonsWithHide

Create and show this widget

from ipywidgets_toggle_buttons import ToggleButtonsWithHide
wid = ToggleButtonsWithHide(
    value="0",
    options_visible=[str(i) for i in range(10)],
    options_hidden=[str(i) for i in range(5, 15)],
)
wid
images/toggle_buttons_with_hide_1.JPG

After pressing the button Show Hidden Options

images/toggle_buttons_with_hide_2.JPG

Select value 12

images/toggle_buttons_with_hide_3.JPG

And hide Hidden options

images/toggle_buttons_with_hide_4.JPG
print(wid.value)  # "12"
wid.options_visible = [str(i) for i in range(2)]
wid.options_hidden = [f"another {i}" for i in range(2)]
images/toggle_buttons_with_hide_5.JPG

MultiToggleButtonsWithHide

Create and show this widget

from ipywidgets_toggle_buttons import MultiToggleButtonsWithHide
wid = MultiToggleButtonsWithHide(
    options_visible=[str(i) for i in range(10)],
    options_hidden=[str(i) for i in range(5, 15)],
    max_chosen_values=4,
)
wid
images/multi_toggle_buttons_with_hide_1.JPG

After pressing the button Show Hidden Options

images/multi_toggle_buttons_with_hide_2.JPG

Select a few options and hide all Hidden options

images/multi_toggle_buttons_with_hide_3.JPG
print(wid.value)  # ('1', '9', '11', '13')
print(wid.options_hidden)  # ('10', '11', '12', '13', '14')

If at any moment you want to change the options then it can be done like shown below

wid.options_visible = [str(i) for i in range(2)]
wid.options_hidden = [f"another {i}" for i in range(2)]

Contacts

License

This project is licensed under the MIT License.

Metadata

Release files for ipywidgets-toggle-buttons 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipywidgets-toggle-buttons 0.2.3
File Size Uploaded Provenance
ipywidgets_toggle_buttons-0.2.3.tar.gz 9.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ipywidgets-toggle-buttons 0.2.3
File Interpreter ABI Platform
ipywidgets_toggle_buttons-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / ipywidgets_toggle_buttons-0.2.3.tar.gz

Download URL ipywidgets_toggle_buttons-0.2.3.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9e393e4d22356d803d0e350d22e0ab525ead9d3d41bb03e0f43007b1353f73d7
BLAKE2b-256 checksum
How to use checksums
e24320f8c7ee1e87b844890608c6d6e50d728dffa3bc768bda23b861ca96a7a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.0 Windows/10

Release files / ipywidgets_toggle_buttons-0.2.3-py3-none-any.whl

Download URL ipywidgets_toggle_buttons-0.2.3-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a6d9dd6417b48587644da747a65d025a36dc2450a6af4bb0db08451875f35d9
BLAKE2b-256 checksum
How to use checksums
9902b530da489e97fbb0614c10c70dd94083694612ea8b01330d6937314293bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.0 Windows/10

Security for ipywidgets-toggle-buttons 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page