mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Move the tutorial over to using ScrollableContainer
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
from time import monotonic
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Container
|
||||
from textual.containers import ScrollableContainer
|
||||
from textual.reactive import reactive
|
||||
from textual.widgets import Button, Header, Footer, Static
|
||||
from textual.widgets import Button, Footer, Header, Static
|
||||
|
||||
|
||||
class TimeDisplay(Static):
|
||||
@@ -83,7 +83,7 @@ class StopwatchApp(App):
|
||||
"""Called to add widgets to the app."""
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(Stopwatch(), Stopwatch(), Stopwatch(), id="timers")
|
||||
yield ScrollableContainer(Stopwatch(), Stopwatch(), Stopwatch(), id="timers")
|
||||
|
||||
def action_add_stopwatch(self) -> None:
|
||||
"""An action to add a timer."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Container
|
||||
from textual.widgets import Button, Header, Footer, Static
|
||||
from textual.containers import ScrollableContainer
|
||||
from textual.widgets import Button, Footer, Header, Static
|
||||
|
||||
|
||||
class TimeDisplay(Static):
|
||||
@@ -27,7 +27,7 @@ class StopwatchApp(App):
|
||||
"""Create child widgets for the app."""
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
yield ScrollableContainer(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
|
||||
def action_toggle_dark(self) -> None:
|
||||
"""An action to toggle dark mode."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Container
|
||||
from textual.widgets import Button, Header, Footer, Static
|
||||
from textual.containers import ScrollableContainer
|
||||
from textual.widgets import Button, Footer, Header, Static
|
||||
|
||||
|
||||
class TimeDisplay(Static):
|
||||
@@ -28,7 +28,7 @@ class StopwatchApp(App):
|
||||
"""Create child widgets for the app."""
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
yield ScrollableContainer(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
|
||||
def action_toggle_dark(self) -> None:
|
||||
"""An action to toggle dark mode."""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Container
|
||||
from textual.widgets import Button, Header, Footer, Static
|
||||
from textual.containers import ScrollableContainer
|
||||
from textual.widgets import Button, Footer, Header, Static
|
||||
|
||||
|
||||
class TimeDisplay(Static):
|
||||
@@ -35,7 +35,7 @@ class StopwatchApp(App):
|
||||
"""Create child widgets for the app."""
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
yield ScrollableContainer(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
|
||||
def action_toggle_dark(self) -> None:
|
||||
"""An action to toggle dark mode."""
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from time import monotonic
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Container
|
||||
from textual.containers import ScrollableContainer
|
||||
from textual.reactive import reactive
|
||||
from textual.widgets import Button, Header, Footer, Static
|
||||
from textual.widgets import Button, Footer, Header, Static
|
||||
|
||||
|
||||
class TimeDisplay(Static):
|
||||
@@ -55,7 +55,7 @@ class StopwatchApp(App):
|
||||
"""Create child widgets for the app."""
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
yield ScrollableContainer(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
|
||||
def action_toggle_dark(self) -> None:
|
||||
"""An action to toggle dark mode."""
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from time import monotonic
|
||||
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.containers import Container
|
||||
from textual.containers import ScrollableContainer
|
||||
from textual.reactive import reactive
|
||||
from textual.widgets import Button, Header, Footer, Static
|
||||
from textual.widgets import Button, Footer, Header, Static
|
||||
|
||||
|
||||
class TimeDisplay(Static):
|
||||
@@ -78,7 +78,7 @@ class StopwatchApp(App):
|
||||
"""Called to add widgets to the app."""
|
||||
yield Header()
|
||||
yield Footer()
|
||||
yield Container(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
yield ScrollableContainer(Stopwatch(), Stopwatch(), Stopwatch())
|
||||
|
||||
def action_toggle_dark(self) -> None:
|
||||
"""An action to toggle dark mode."""
|
||||
|
||||
Reference in New Issue
Block a user