TextualOutputWriter
Base classes¶
| Name | Children | Inherits |
|---|---|---|
| OutputWriter slashed.base Interface for command output. |
â‹” Inheritance diagram¶
graph TD
236713483["app.TextualOutputWriter"]
1594020653["base.OutputWriter"]
1073422405["typing.Protocol"]
3481597255["typing.Generic"]
2751680898["builtins.object"]
1594020653 --> 236713483
1073422405 --> 1594020653
3481597255 --> 1073422405
2751680898 --> 3481597255
🛈 DocStrings¶
Bases: OutputWriter
Output writer that routes messages to bound widgets.
Supports different widget types: - Labels: Direct update of content - VerticalScroll/Container: Mount new Label with content - Other widgets: Try update() method
Source code in src/slashed/textual_adapter/app.py
bind
¶
Bind an output to a widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_id
|
str
|
ID for this output stream |
required |
widget_query
|
str
|
CSS query to find the target widget |
required |
default
|
bool
|
Whether this is the default output for unspecified streams |
False
|
Source code in src/slashed/textual_adapter/app.py
print
async
¶
Print message to bound widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Message to display |
required |
output_id
|
str | None
|
Optional output stream ID. Uses default if not specified. |
None
|
The message is handled differently based on widget type: - For containers (VerticalScroll/Container): Mount new Label - For Label widgets: Update content - For other widgets: Try update() method
Raises:
| Type | Description |
|---|---|
ValueError
|
If no default binding is configured or binding not found |
TypeError
|
If widget type is not supported |