Skip to main content

A versatile slider with fine-tuned control, adjustable precision, and direct text input for exact values.

Project description

panel-precision-slider

CI pypi-version python-version

A versatile slider with fine-tuned control, adjustable precision, and direct text input for exact values.

Export-1732234916141

Features

  • Toggle Between Slider and Input: Switch between a slider and a direct input field for value selection.
  • Adjustable Step Size: Show or hide the step size adjustment slider to control the precision of the value.
  • Customizable Icons: Use toggle icons to enhance the user interface for swapping views and showing steps.

Installation

Install it via pip:

pip install panel-precision-slider

Development

This project is managed by pixi. You can install the package in development mode using:

git clone https://github.com/panel-extensions/panel-precision-slider
cd panel-precision-slider

pixi run pre-commit-install
pixi run postinstall
pixi run test

Usage

The PrecisionSlider is a custom Panel component that provides a synchronized slider and input field for selecting numerical values with adjustable precision. Users can toggle between a slider and a direct input field, as well as show or hide the step size adjustment.

Basic Example

import panel as pn
from panel_precision_slider import PrecisionSlider

pn.extension()

# Instantiate the PrecisionSlider
precision_slider = PrecisionSlider(
    value=5,
    min=0,
    max=10,
    step=0.1,
    show_step=True,
    swap=False
)

# Display the slider
precision_slider

Integrating with Other Panel Components

You can integrate PrecisionSlider with other Panel widgets and layouts to build interactive dashboards.

import panel as pn
import numpy as np
import holoviews as hv
from panel_precision_slider import PrecisionSlider

hv.extension('bokeh')
pn.extension()

def sine_wave(frequency):
    x = np.linspace(0, 10, 500)
    y = np.sin(2 * np.pi * frequency * x)
    return hv.Curve((x, y), 'x', 'sin(2πfx)')

precision_slider = PrecisionSlider(name="Select Value", value=2.5, min=0, max=5, step=0.05)
sine_plot = pn.bind(sine_wave, precision_slider.param.value)

layout = pn.Column(
    "### Precision Slider Example",
    precision_slider,
    sine_plot
)

layout.servable()

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch: git checkout -b feature/YourFeature.
  3. Make your changes and commit them: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature/YourFeature.
  5. Open a pull request.

Please ensure your code adheres to the project's coding standards and passes all tests.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panel_precision_slider-0.0.1.tar.gz (116.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

panel_precision_slider-0.0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file panel_precision_slider-0.0.1.tar.gz.

File metadata

  • Download URL: panel_precision_slider-0.0.1.tar.gz
  • Upload date:
  • Size: 116.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.8

File hashes

Hashes for panel_precision_slider-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f8a0798e681a3ff9d40647f2cd7c1c6e93bf73b793528390f457f4cfb389f560
MD5 f7f37427f5a7cc885533d1764dfe86d8
BLAKE2b-256 5455acbb496266f216765ffb91a14fb5f9606a8213297680790f0e4b756403ad

See more details on using hashes here.

File details

Details for the file panel_precision_slider-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for panel_precision_slider-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 febbd34a4ec644e21aa1c59fc7d103254b7ade8da954c02a93cd03c2c7c6a789
MD5 011df1415fa289dad4eb868e8fcbf716
BLAKE2b-256 8524e84b158dec98ea98a4c10ddf1f70940880bb0e552d149ab5f0eff73bdd60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page