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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I want my
console.log's,console.print's, andconsole.statuscalls all padded 5 chars on the left and right. I have managed to get it to work forconsole.logby overriding the_log_renderof the Console and adding padding on theTable.gridof the LogRenderer. Forconsole.statusI 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 allobjectswithPadding(), 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.widthby 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 colorANSI codes) on the left and right of the entire console. E.g., if you doconsole.print("Hello World")with a theme that setsnonetored on whiteit should render asHello Worldwith the color red, and the background as white, for everything including the whitespace.Beta Was this translation helpful? Give feedback.
All reactions