-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable animation of offset with a tuple #3028
Comments
The problem seems to be trying to animate a propery of type from textual.app import App, ComposeResult
from textual.css.scalar import ScalarOffset # <-- Changed import
from textual.widgets import Footer, Static
class ExampleApp(App):
BINDINGS = [("space", "animate_offset", "Animate Offet")]
CSS = """
Screen {
align: center middle;
}
Static {
background: red;
width: auto;
height: 3;
content-align: center middle;
}
"""
def compose(self) -> ComposeResult:
yield Static("Animate me!")
yield Footer()
def action_animate_offset(self) -> None:
static = self.query_one(Static)
static.styles.animate(
attribute="offset",
value=ScalarOffset.from_offset((10, 10)), # <-- Changed here
duration=0.5,
)
if __name__ == "__main__":
app = ExampleApp()
app.run() This still leaves a few problems:
P.S. I used |
I think it should work in the way Tom intuited. If the ScalarOffset that @yuvalmo suggested works, then that might be a good workaround for now. But in the future it should really be as simple as animating to the tuple of two values. |
Added unit tests as well.
Added unit tests as well.
The docs say that "You can apply animations to styles such as offset to move widgets around the screen".
But how?
I found this discussion #1569 from back in January, which suggests this might be a bug?
The text was updated successfully, but these errors were encountered: