npyscreen
npyscreen copied to clipboard
string using color
Hi,
I read into documentation about color to set Theme, in case I want to change not the Theme BUT, how can I change only some word into msg notify ?
this a WARNING! message.!
this is .... message -> white bold WARNING -> only red this word between the white bolds of "this is.... message"
is possible to do it ?
I try it using colorama library but works using normally with print() function but adding the code into npyscreen notify window, output the message changing the color by bash code to put red so. came this way as result.
This is a [0;31m'Warning message.
And of course all message was white using theme of npyscreen.
I can reach to put color string in the print but show up in the wrong position
this is the code:
def Red(string): print("\033[91m {}\033[00m" .format(string))
in the class to notify on npyscreen ... msg = 'Must to be' + str(self.Red('debian-keyring')) + 'installed' npyscreen.notify_confirm(msg)
and the windows show up this way putting the red word out instead between the message.
if I not use the function and putting directly into the msg to not print outside show up without formated color.
any idea ? thanks any way
Hi, look this post: https://medium.com/@ValTron/create-tui-on-python-71377849879d