You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will McGugan edited this page Nov 1, 2022
·
1 revision
# Mount at startself.mount(Foo())
self.mount(Foo(), before=0)
# Mount before first Fooself.mount(Foo(), before="Foo")
# Equivalent to...self.mount(Foo(), before=self.query_one("Foo"))
# Mount multiple widgetsself.mount(Foo(), Bar(), Baz())
# Mount at endself.mount(Foo())
self.mount(Foo(), after=-1)
# Add widget after another widgetself.mount(Foo(), after="#bar")
There will be other options once we implement :first and :last psuedo-selectors
# Mount before first Fooself.mount(Foo(), before="Foo:first")
# Mount after last fooself.mount(Foo(), after="Foo:last")
Thinking about selectors. Calling self.query would return grandchildren. It would be reasonable to expect that to do the same in mount. I think that a selector, i.e. self.mount(Foo(), before="Foo") should effectively do a query_one and mount before that widget, which may not be an immediate child.