mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
API for updating value of textinput widget
This commit is contained in:
@@ -30,10 +30,10 @@ class InputApp(App[str]):
|
||||
return
|
||||
if event.sender == self.celsius:
|
||||
fahrenheit = celsius_to_fahrenheit(value)
|
||||
self.fahrenheit.current_text = f"{fahrenheit:.1f}"
|
||||
self.fahrenheit.value = f"{fahrenheit:.1f}"
|
||||
elif event.sender == self.fahrenheit:
|
||||
celsius = fahrenheit_to_celsius(value)
|
||||
self.celsius.current_text = f"{celsius:.1f}"
|
||||
self.celsius.value = f"{celsius:.1f}"
|
||||
|
||||
|
||||
app = InputApp(
|
||||
|
||||
@@ -22,6 +22,10 @@ Screen {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#celsius :focus {
|
||||
border: heavy darkgoldenrod;
|
||||
}
|
||||
|
||||
#inputs {
|
||||
dock: top;
|
||||
background: $primary;
|
||||
@@ -38,3 +42,7 @@ Screen {
|
||||
height: 1;
|
||||
border: ;
|
||||
}
|
||||
|
||||
#footer :focus {
|
||||
border: heavy $secondary;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user