Nov-21-2022, 12:24 PM
(This post was last modified: Nov-21-2022, 12:24 PM by BliepMonster.)
(Nov-20-2022, 07:04 PM)Gribouillis Wrote:(Nov-20-2022, 05:19 PM)BliepMonster Wrote: I already found a solution, so I won't use 'Rich' or anything else.Can you share your solution to print with colors in the IDLE IDE?
The solution to printing text:
import sys color = sys.stdout.shell color.write('Anything you want', 'STRING') color.write('can go here\n', 'STRING') color.write('Just remember to end the line with the \\n', 'STRING')
Output:Anything you want can go here
Just remember to end the line with the \n
(In the string color)Now, this doesn't work for variables. For that, you can just use print() with end=' ' to keep it on the same line. It isn't as good as color, but it works.
import sys color = sys.stdout.shell color.write('This', 'STRING') print('Is on the same line', end = ' ') color.write('As this', 'STRING')
The only stupid person in the world, is the person that doesn't ask questions.
-Someone smart
-Someone smart