-
-
Couldn't load subscription status.
- Fork 1k
Closed
Description
Building upon this, but adding #line selector:
from textual import on
from textual.app import App, ComposeResult
from textual.widgets import Header, Select
LINES = """I must not fear.
Fear is the mind-killer.
Fear is the little-death that brings total obliteration.
I will face my fear.
I will permit it to pass over me and through me.""".splitlines()
class SelectApp(App):
def compose(self) -> ComposeResult:
yield Header()
yield Select(((line, line) for line in LINES), id="line")
@on(Select.Changed, "#line")
def select_changed(self, event: Select.Changed) -> None:
self.title = str(event.value)
if __name__ == "__main__":
app = SelectApp()
app.run()Causes:
Traceback (most recent call last):
File "/home/dave/ng/textual-select-on.py", line 12, in <module>
class SelectApp(App):
File "/home/dave/ng/textual-select-on.py", line 17, in SelectApp
@on(Select.Changed, "#line")
File "/home/dave/.pyenv/versions/ng/lib/python3.10/site-packages/textual/_on.py", line 69, in on
raise OnDecoratorError(
textual._on.OnDecoratorError: The message class must have a 'control' to match with the on decorator
Textual Diagnostics
Versions
| Name | Value |
|---|---|
| Textual | 0.26.0 |
| Rich | 13.3.3 |
Python
| Name | Value |
|---|---|
| Version | 3.10.9 |
| Implementation | CPython |
| Compiler | GCC 9.4.0 |
| Executable | /home/dave/.pyenv/versions/3.10.9/envs/ng/bin/python3.10 |
Operating System
| Name | Value |
|---|---|
| System | Linux |
| Release | 5.14.0-1059-oem |
| Version | #67-Ubuntu SMP Mon Mar 13 14:22:10 UTC 2023 |
Terminal
| Name | Value |
|---|---|
| Terminal Application | vscode (1.78.2) |
| TERM | xterm-256color |
| COLORTERM | truecolor |
| FORCE_COLOR | Not set |
| NO_COLOR | Not set |
Rich Console options
| Name | Value |
|---|---|
| size | width=95, height=59 |
| legacy_windows | False |
| min_width | 1 |
| max_width | 95 |
| is_terminal | True |
| encoding | utf-8 |
| max_height | 59 |
| justify | None |
| overflow | None |
| no_wrap | False |
| highlight | None |
| markup | None |
| height | None |
Metadata
Metadata
Assignees
Labels
No labels