Comments (4)
Thank you both for writing back. Regarding point 2 animation-- i did figure out to use a callback several hours later... And instantly felt dumb reflecting about (this) earlier GH issue :)
async def on_blur(self, _: events.Blur) -> None:
# ....
self.styles.animate("background", value="green", duration=1.0, on_complete=self._restore_orig_background_color)
self.notify(f"Successfully updated {save_field} with new value: {new_value}")
def _restore_orig_background_color(self):
self.styles.animate("background", value=self._orig_styles_background, duration=1.0)
... what i did not figure out was your nifty use of partial
, cheers to that idea.
ok i must return to building.
good afternoon and thanks again!
from textual.
We found the following entries in the FAQ which you may find helpful:
Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.
This is an automated reply, generated by FAQtory
from textual.
On point 2: it's because you're essentially overriding the first animation with the second. This is where you'd use on_complete
. For example:
from functools import partial
from textual.app import App, ComposeResult
from textual.widgets import Button
class HideThenShowApp(App[None]):
def compose(self) -> ComposeResult:
yield Button("Watch me disappear then appear!")
def on_mount(self) -> None:
self.query_one(Button).styles.animate(
"opacity",
value=0.0,
duration=2.0,
on_complete=partial(
self.query_one(Button).styles.animate,
"opacity",
value=1.0,
duration=2.0
)
)
if __name__ == "__main__":
HideThenShowApp().run()
Remember: the call to animate isn't blocking.
from textual.
Good spot regarding the broken examples in the docs! Just to clarify in case there's any confusion, these are only screenshots rather than "embedded terminals".
This has been reported and fixed once before, but there must have been a regression after changes to the code to generate the screenshots.
from textual.
Related Issues (20)
- `ProgressBar` ETA goes adrift if a progress bar is "reused" HOT 2
- Highlight in the suspend example is off by a line HOT 1
- `Option` indexing appears to break after an `OptionList.clear_options` and `OptionList.add_option(s)` HOT 4
- Regression in Textual 0.48 when executing app in a subprocess HOT 16
- `TextArea` still has a cursor, until it's had focus and then lost it HOT 8
- `TextArea` still uses `Escape` to move focus on HOT 3
- Show all commands in command palette HOT 10
- Both parent's and child's [on_mount] method are called in runtime HOT 3
- Consider signing commits/releases with PGP HOT 1
- No module named 'textual'
- Writing to a hidden RichLog breaks table alignment HOT 7
- Expose ANSI themes HOT 8
- `DirectoryTree.clear_node` doesn't actually clear the node HOT 1
- Select widget "disabled" HOT 1
- Add `remove` attribute to `mount` and `mount_all` HOT 7
- Add a `lock` to every widget. HOT 3
- Clarify `Input` docs about removing spacing HOT 1
- Input widgets error when I configure type arguments
- A Widget with {margin: 1} style in a ScrollableContainer causes infinite resizes and scrollbars flicker HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from textual.