Giter Club home page Giter Club logo

Comments (4)

traveller1011 avatar traveller1011 commented on May 24, 2024 2

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.

github-actions avatar github-actions commented on May 24, 2024 1

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.

davep avatar davep commented on May 24, 2024 1

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.

TomJGooding avatar TomJGooding commented on May 24, 2024 1

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.