How can I have a panel with centred console markup? #637
Answered
by
willmcgugan
ciaransweet
asked this question in
Q&A
-
If I render a Widget of: from rich.panel import Panel
# from rich.text import Text
from textual.widget import Widget
class TitleBar(Widget):
def render(self) -> Panel:
return Panel("[b]Terraform Workspaces[/b]\n:star: == Active Workspace", height=6) I get: But really I want the text centred in the panel. I tried to use from rich.panel import Panel
from rich.text import Text
from textual.widget import Widget
class TitleBar(Widget):
def render(self) -> Panel:
return Panel(Text("[b]Terraform Workspaces[/b]\n:star: == Active Workspace", justify="center"), height=6) I get: Which is centred... but my markup disappears 😅 Appreciate any thoughts folks have! I'm having a great time playing with this |
Beta Was this translation helpful? Give feedback.
Answered by
willmcgugan
Aug 5, 2022
Replies: 1 comment 2 replies
-
Hi Ciaran, You want |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ciaransweet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Ciaran,
You want
Text.from_markup()
to also process the console markup.