fixed some rendering glitches

This commit is contained in:
Will McGugan
2022-11-17 16:59:29 +00:00
parent 3d35a602b5
commit d9a0da91a4
4 changed files with 2184 additions and 100 deletions

1944
examples/food.json Normal file

File diff suppressed because it is too large Load Diff

32
examples/tree.py Normal file
View File

@@ -0,0 +1,32 @@
import json
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Tree
with open("food.json") as data_file:
data = json.load(data_file)
from rich import print
print(data)
class TreeApp(App):
BINDINGS = [("a", "add", "Add node")]
def compose(self) -> ComposeResult:
yield Header()
yield Footer()
yield Tree("Root")
def action_add(self) -> None:
tree = self.query_one(Tree)
tree.add_json(data)
if __name__ == "__main__":
app = TreeApp()
app.run()