mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge branch 'main' of https://github.com/Textualize/Textual into placeholder
This commit is contained in:
@@ -48,7 +48,7 @@ class Hello(Static):
|
||||
|
||||
|
||||
class CustomApp(App):
|
||||
CSS_PATH = "hello03.css"
|
||||
CSS_PATH = "hello04.css"
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Hello()
|
||||
|
||||
@@ -32,13 +32,13 @@ class TimeDisplay(Static):
|
||||
self.start_time = monotonic()
|
||||
self.update_timer.resume()
|
||||
|
||||
def stop(self):
|
||||
def stop(self) -> None:
|
||||
"""Method to stop the time display updating."""
|
||||
self.update_timer.pause()
|
||||
self.total += monotonic() - self.start_time
|
||||
self.time = self.total
|
||||
|
||||
def reset(self):
|
||||
def reset(self) -> None:
|
||||
"""Method to reset the time display to zero."""
|
||||
self.total = 0
|
||||
self.time = 0
|
||||
|
||||
12
docs/examples/widgets/directory_tree.py
Normal file
12
docs/examples/widgets/directory_tree.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import DirectoryTree
|
||||
|
||||
|
||||
class DirectoryTreeApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield DirectoryTree("./")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = DirectoryTreeApp()
|
||||
app.run()
|
||||
18
docs/examples/widgets/tree.py
Normal file
18
docs/examples/widgets/tree.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import Tree
|
||||
|
||||
|
||||
class TreeApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
tree: Tree = Tree("Dune")
|
||||
tree.root.expand()
|
||||
characters = tree.root.add("Characters", expand=True)
|
||||
characters.add_leaf("Paul")
|
||||
characters.add_leaf("Jessica")
|
||||
characters.add_leaf("Channi")
|
||||
yield tree
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = TreeApp()
|
||||
app.run()
|
||||
Reference in New Issue
Block a user