Strip
A Strip contains the result of rendering a widget. See line API for how to use Strips.
Strip
class
¶
Represents a 'strip' (horizontal line) of a Textual Widget.
A Strip is like an immutable list of Segments. The immutability allows for effective caching.
Parameters
Parameter | Default | Description |
---|---|---|
segments
Iterable[Segment]
|
required | An iterable of segments. |
cell_length
int | None
|
None
|
The cell length if known, or None to calculate on demand. |
adjust_cell_length
method
¶
apply_filter
method
¶
Apply a filter to all segments in the strip.
Parameters
Parameter | Default | Description |
---|---|---|
filter
LineFilter
|
required | A line filter object. |
Returns
Type | Description |
---|---|
Strip
|
A new Strip. |
apply_style
method
¶
blank
classmethod
¶
crop
method
¶
crop_extend
method
¶
divide
method
¶
extend_cell_length
method
¶
from_lines
classmethod
¶
Convert lines (lists of segments) to a list of Strips.
Parameters
Parameter | Default | Description |
---|---|---|
lines
list[list[Segment]]
|
required | List of lines, where a line is a list of segments. |
cell_length
int | None
|
None
|
Cell length of lines (must be same) or None if not known. |
Returns
Type | Description |
---|---|
list[Strip]
|
List of strips. |
index_to_cell_position
method
¶
Given a character index, return the cell position of that character.
This is the sum of the cell lengths of all the characters before the character
at index
.
Parameters
Parameter | Default | Description |
---|---|---|
index
int
|
required | The index to convert. |
Returns
Type | Description |
---|---|
int
|
The cell position of the character at |
join
classmethod
¶
simplify
method
¶
style_links
method
¶
StripRenderable
class
¶
A renderable which renders a list of strips in to lines.