Can I add console-level padding? #2834
Unanswered
rlaphoenix
asked this question in
Q&A
Replies: 1 comment
-
This is what I'm doing at the moment, but it doesn't work for everything: class ConsoleWithPadding(Console):
def print(self, *args, **kwargs):
super().print(Padding(*args, (0, 2)), **kwargs) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want my
console.log
's,console.print
's, andconsole.status
calls all padded 5 chars on the left and right. I have managed to get it to work forconsole.log
by overriding the_log_render
of the Console and adding padding on theTable.grid
of the LogRenderer. Forconsole.status
I have overridden it with the following:However, I have not found an ample solution for
print
, as if I do a similar trick by wrapping allobjects
withPadding()
, it seems to affectStatus
's transient properties. It would randomly be transient and non-transient, seemingly depending on how fast it finished the status, or rather how little it refreshed. Or, it will not be transient ever, if the terminal width is not greater than or equal to theconsole.width
by two times, for some reason.To be clear on what I'm asking for, I want to be able to prepend 5 chars of blank (with
on color
ANSI codes) on the left and right of the entire console. E.g., if you doconsole.print("Hello World")
with a theme that setsnone
tored on white
it should render asHello World
with the color red, and the background as white, for everything including the whitespace.Beta Was this translation helpful? Give feedback.
All reactions