A thin slider control widget for the Textual UI platform
Project description
Textual Thin Slider
A thin slider widget for the Textual UI platform. The thin slider widget is only 1 character tall and allows fine control to choose a value within a range. Options include, no value display, percentage or value. Value may displayed on left or right of slider bar.
Installation
pip install thin-textual-slider
uv add thin-textual-slider
Usage
Display Option Enum and Widget Control Arguments
class ThinSliderDisplayOptions(IntEnum):
""" How should we show values with the slider bar, use bitwise and/or to set/read values. """
none = 0 # Do not display the percentage or value (default)
display_left = 1 # Display percentage/value to the left of the slider bar
display_right = 2 # Display percentage/value to the right of the slider bar
show_value = 4 # Show current slider value instead of percentage
class ThinSlider(
range_min: int,
range_max: int,
value: int,
step: int,
display_type: ThinSliderDisplayOptions
)
# Programmatically change slider value
slider.value = {new integer value}
Example: Textual App Usage With Event Message
from textual import on
from textual.app import ComposeResult, App
from textual_thin_slider import ThinSlider, ThinSliderDisplayOptions
class SimpleSliderApp(App):
slider_value: int = 0
slider_percentage: float = 0.0
def compose(self) -> ComposeResult:
yield ThinSlider(
id="test-slider",
range_min=0,
range_max=250,
display_type=ThinSliderDisplayOptions.display_right | ThinSliderDisplayOptions.show_value
)
@on(ThinSlider.Changed, "#test-slider")
def on_thin_slider_changed(self, event: ThinSlider.Changed) -> None:
self.slider_value = event.value
self.slider_percentage = event.control.percent
if __name__ == "__main__":
app = SimpleSliderApp()
app.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textual_thin_slider-1.0.1.tar.gz.
File metadata
- Download URL: textual_thin_slider-1.0.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
489ae2c1338b6970333bcc2419f925db7e0852721e1a47f0e620af791712b2a4
|
|
| MD5 |
8c704779b57d25d76bf126e7e817d344
|
|
| BLAKE2b-256 |
bc4c5ee5b6d2b97d29c812b9683160f16ffa9a0f6b69078a97d6645c012c484a
|
File details
Details for the file textual_thin_slider-1.0.1-py3-none-any.whl.
File metadata
- Download URL: textual_thin_slider-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f5437b0dc40b401a58b252b5d9f72fa194dd37ce7648ed99d2b11f2d702b872
|
|
| MD5 |
cf3ce8f6ad7dec55a8b953c777361f1c
|
|
| BLAKE2b-256 |
cb5b79c54a223e00f2b6d8f182624551c645be62ed3879fe997933b35be58778
|