dashing¶
Overview¶
Dashing allows to quickly create terminal-based dashboards in Python.
It focuses on practicality over completeness. If you want to have complete control over every character on the screen, use ncurses or similar.
Dashing automatically fills the screen with “tiles”.
There are 2 type of “container” tiles that allow vertical and horizontal splitting called VSplit and HSplit. Dashing scales them based on the screen size.
Any tile passed as argument at init time will be nested using the .items attribute
.items can be used to access, add or remove nested tiles.
You can easily extend Dashing with new tile types. Subclass Tile
, implement
__init__ and _display. See dashing.py for examples.
- The other types of tiles are:
Text
- simple textLog
- a log pane that scrolls automaticallyHGauge
- horizontal gaugeVGauge
- vertical gaugeColorRangeVGauge
- vertical gauge with coloringVChart
- vertical chartHChart
- horizontal chartHBrailleChart
HBrailleFilledChart
All tiles accept title, color, border_color keywords arguments at init time.
Gauges represent an instant value between 0 and 100. You can set a value at init time using the val keyword argument or access the .value attribute at any time.
Charts represent a sequence of values between 0 and 100 and scroll automatically.
Call display()
on the root element to display or update the ui.
You can easily nest splits and tiles as in:
ui = HSplit(
VSplit(
HGauge(val=50, title="foo", border_color=5),
)
)
# access a tile by index
gauge = ui.items[0].items[0]
gauge.value = 3.0
# display/refresh the ui
ui.display()
-
class
dashing.dashing.
ColorRangeVGauge
(val=100, colormap=(), **kw)¶ Vertical gauge with color map. E.g.: green gauge for values below 50, red otherwise: colormap=((50, 2), (100, 1))
-
class
dashing.dashing.
HBrailleChart
(val=100, *args, **kw)¶ Horizontal chart made with dots
-
append
(dp)¶ Append a new value: int or float between 1 and 100
-
-
class
dashing.dashing.
HBrailleFilledChart
(val=100, *args, **kw)¶ Horizontal chart, filled with dots
-
append
(dp)¶ Append a new value: int or float between 1 and 100
-
-
class
dashing.dashing.
HChart
(val=100, *args, **kw)¶ Horizontal chart, filled
-
append
(dp)¶ Append a new value: int or float between 1 and 100
-
-
class
dashing.dashing.
HGauge
(label=None, val=100, color=2, **kw)¶ Horizontal gauge
-
class
dashing.dashing.
HSplit
(*items, **kw)¶
-
class
dashing.dashing.
Log
(*args, **kw)¶ A log pane that scrolls automatically. Add new lines with
append()
-
append
(msg)¶ Append a new log message at the bottom
-
-
class
dashing.dashing.
Split
(*items, **kw)¶ Split a box vertically (VSplit) or horizontally (HSplit)
-
class
dashing.dashing.
TBox
(t, x, y, w, h)¶ -
h
¶ Alias for field number 4
-
t
¶ Alias for field number 0
-
w
¶ Alias for field number 3
-
x
¶ Alias for field number 1
-
y
¶ Alias for field number 2
-
-
class
dashing.dashing.
Text
(text, color=0, *args, **kw)¶ A multi-line text box. Example:
Text(‘Hello World, this is dashing.’, border_color=2),
-
class
dashing.dashing.
VChart
(val=100, *args, **kw)¶ Vertical chart. Values must be between 0 and 100 and can be float.
-
append
(dp)¶ Append a new value: int or float between 1 and 100
-
-
class
dashing.dashing.
VGauge
(val=100, color=2, **kw)¶ Vertical gauge
-
class
dashing.dashing.
VSplit
(*items, **kw)¶