mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
renderer refactor
This commit is contained in:
5
examples/README.md
Normal file
5
examples/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Examples
|
||||
|
||||
Run any of these examples to demonstrate a features.
|
||||
|
||||
These examples may not be feature complete, but they should be somewhat useful and a good starting point for your own code.
|
||||
20
examples/test_layout.py
Normal file
20
examples/test_layout.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from rich import print
|
||||
from rich.console import Console
|
||||
|
||||
from textual.geometry import Offset, Region
|
||||
from textual.widgets import Placeholder
|
||||
|
||||
|
||||
from textual.views import WindowView
|
||||
|
||||
p = Placeholder(height=10)
|
||||
view = WindowView(p)
|
||||
|
||||
console = Console()
|
||||
view.layout.reflow(console, 30, 25, Offset(0, 3))
|
||||
|
||||
print(view.layout._layout_map.widgets)
|
||||
|
||||
console.print(view.layout.render(console))
|
||||
|
||||
# console.print(view.layout.render(console, Region(100, 2, 10, 10)))
|
||||
19
examples/vertical.py
Normal file
19
examples/vertical.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from textual import events
|
||||
from textual.app import App
|
||||
|
||||
from textual.views import WindowView
|
||||
from textual.widgets import Placeholder
|
||||
|
||||
|
||||
class MyApp(App):
|
||||
async def on_mount(self, event: events.Mount) -> None:
|
||||
window1 = WindowView(Placeholder(height=20))
|
||||
# window2 = WindowView(Placeholder(height=20))
|
||||
|
||||
# window1.scroll_x = -10
|
||||
# window1.scroll_y = 5
|
||||
|
||||
await self.view.dock(window1, edge="left")
|
||||
|
||||
|
||||
MyApp.run(log="textual.log")
|
||||
Reference in New Issue
Block a user