-
I've been looking at the docks about layouts, specifically these two links https://textual.textualize.io/how-to/design-a-layout/ https://textual.textualize.io/guide/layout/ Now I want to make a layourt where I have a component on one half and two stacked on the other half but when making the layout I keep getting an exception class View(App):
logger: LogView
taxi: Taxi
async def on_mount(self):
self.logger = LogView()
self.taxi = Taxi(self.logger)
self.taxi.iniciar()
def compose(self) -> ComposeResult:
yield Vertical(
Horizontal(
self.logger, # Extends ScrollView
self.taxi.view_sensores() # Extends ScrollView
)
)
async def on_key(self, event):
if event.key == "q":
await self.action_quit()
def get_logger(self):
return self.logger How am I supposed to make a layout from the state of my app? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The problem is that your class variables haven't been initialized, because Could you explain what you're trying to achieve, as I'm afraid I'm not sure I follow? |
Beta Was this translation helpful? Give feedback.
I was trying to hold onto a reference of the components to be able to use their methods. After looking thru the examples folder I was able to figure out that the way to do this is using the
query_one
method so I did some refactoring now it works!