-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #608 from Textualize/scroll-to
Improvements to scroll_to_widget
- Loading branch information
Showing
14 changed files
with
175 additions
and
86 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
Button { | ||
margin: 1; | ||
width: 100%; | ||
} | ||
|
||
Vertical { | ||
height: auto; | ||
} | ||
|
||
Horizontal { | ||
height: auto; | ||
} | ||
|
||
Horizontal Button { | ||
width: 20; | ||
|
||
margin: 1 2 ; | ||
} | ||
|
||
#scroll { | ||
height: 10; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from textual import layout, events | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import Button | ||
|
||
|
||
class ButtonsApp(App[str]): | ||
def compose(self) -> ComposeResult: | ||
yield layout.Vertical( | ||
Button("default", id="foo"), | ||
Button("Where there is a Will"), | ||
Button("There is a Way"), | ||
Button("There can be only one"), | ||
Button.success("success", id="bar"), | ||
layout.Horizontal( | ||
Button("Where there is a Will"), | ||
Button("There is a Way"), | ||
Button("There can be only one"), | ||
Button.warning("warning", id="baz"), | ||
Button("Where there is a Will"), | ||
Button("There is a Way"), | ||
Button("There can be only one"), | ||
id="scroll", | ||
), | ||
Button.error("error", id="baz"), | ||
Button("Where there is a Will"), | ||
Button("There is a Way"), | ||
Button("There can be only one"), | ||
) | ||
|
||
def handle_pressed(self, event: Button.Pressed) -> None: | ||
self.app.bell() | ||
|
||
async def on_key(self, event: events.Key) -> None: | ||
await self.dispatch_key(event) | ||
|
||
def key_d(self): | ||
self.dark = not self.dark | ||
|
||
|
||
app = ButtonsApp( | ||
log_path="textual.log", css_path="buttons.css", watch_css=True, log_verbosity=2 | ||
) | ||
|
||
if __name__ == "__main__": | ||
result = app.run() | ||
print(repr(result)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.