Select.Blank doesn't work on python 3.9 #3853
-
from textual.app import App, ComposeResult
from textual.containers import *
from textual.widgets import *
from textual import work
class ScriptApp(App):
CSS = """
.unselected {
display: none;
}
.unselected.visible {
display: block;
}
"""
def compose(self) -> ComposeResult:
PROJECT_KEY = [
("LPS", "LPS"),
("LRQA", "LRQA"),
("LRAC", "LRAC"),
("COMMERCE", "COMMERCE"),
]
yield Header()
yield Label("Project Key:", id="project-key-label-2")
yield Select(PROJECT_KEY, id="project-key-2")
yield Label("Summary:", id="summary-label", classes="unselected")
yield Input(id="summary", classes="unselected")
yield Static()
yield Button("Submit", id="button-7")
yield Footer()
@work(exclusive=True, thread=True)
def create_issue(self) -> None:
self.query_one("#button-7").disabled = True
self.query_one("#summary").value = ""
self.query_one("#project-key-2").clear()
self.query_one("#button-7").disabled = False
def on_button_pressed(self, event: Button.Pressed) -> None:
if event.button.id == "button-7":
self.create_issue()
def on_select_changed(self, event: Select.Changed) -> None:
self.query_one("#summary").set_class(event.value != Select.BLANK, "visible")
self.query_one("#summary-label").set_class(
event.value != Select.BLANK, "visible"
)
app = ScriptApp()
if __name__ == "__main__":
app.run() When select an option in Project Key field, this error happened |
Beta Was this translation helpful? Give feedback.
Answered by
TomJGooding
Dec 12, 2023
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Tim-Cao
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Select.BLANK
was added in Textual 0.42.0 - are you using an older version?