Skip to content

Commit 44ec37b

Browse files
committed
Update example, add picture
1 parent cf73df1 commit 44ec37b

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
![Tests Completion Status](https://github.com/robabram/textual-thin-slider/actions/workflows/tests.yaml/badge.svg)
22
![Coverage Status](https://raw.githubusercontent.com/robabram/textual-thin-slider/refs/heads/coverage-badge/coverage.svg?raw=true)
3-
![Supported Python Versions](https://img.shields.io/badge/python-v3.8%20|%20v3.9%20|%20v3.10%20|%20v3.11%20|%20v3.12%20|%20v3.13%20|%20v3.14-blue)
3+
![Supported Python Versions](https://img.shields.io/badge/Python-v3.8%20|%20v3.9%20|%20v3.10%20|%20v3.11%20|%20v3.12%20|%20v3.13%20|%20v3.14-blue)
44
![is support](https://img.shields.io/badge/OS-Linux%20|%20MacOS%20|%20Windows-red)
55
![AI Code Pct](https://img.shields.io/badge/AI-0%25-purple)
66

77
# Textual Thin Slider
8-
A thin slider widgit for the Textual UI platform. The this slider widgit is only 1 character tall and allows
9-
fine control to choose a value within a range.
8+
A thin slider widget for the Textual UI platform. The thin slider widget is only 1 character tall and allows
9+
fine control to choose a value within a range. Options include, no value display, percentage or value. Value may displayed
10+
on left or right of slider bar.
1011

1112

13+
![Slider w/Percent](https://raw.githubusercontent.com/robabram/textual-thin-slider/refs/heads/main/examples/images/slider-percent.png?raw=true)

examples/images/slider-percent.png

2.32 KB
Loading

examples/simple_sliders.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,24 @@
33
# file 'LICENSE', which is part of this source code package.
44
#
55
from textual.app import ComposeResult, App
6+
from textual.containers import Grid
67
from textual.widgets import Header, Footer
78

89
from src.textual_thin_slider.thinslider import ThinSlider, ThinSliderDisplayOptions
910

1011

11-
class SimpleSliderApp(App):
12+
class SimpleSliderGrid(Grid):
13+
14+
DEFAULT_CSS = """
15+
SimpleSliderGrid {
16+
width: 70;
17+
height: 15;
18+
padding: 2 4;
19+
hatch: cross #aaaaaa 20%;
20+
}
21+
"""
1222

1323
def compose(self) -> ComposeResult:
14-
yield Header()
15-
yield Footer()
1624
# Show a slider only with no value display
1725
yield ThinSlider(range_min=0, range_max=1500, value=600, display_type=ThinSliderDisplayOptions.none)
1826
# Show a slider with a percentage shown on the left side
@@ -27,6 +35,16 @@ def compose(self) -> ComposeResult:
2735
display_type=ThinSliderDisplayOptions.display_right | ThinSliderDisplayOptions.show_value)
2836

2937

38+
class SimpleSliderApp(App):
39+
40+
TITLE = "Slider Example"
41+
42+
def compose(self) -> ComposeResult:
43+
yield Header()
44+
yield Footer()
45+
yield SimpleSliderGrid()
46+
47+
3048
if __name__ == "__main__":
3149
app = SimpleSliderApp()
3250
app.run()

0 commit comments

Comments
 (0)