Change printed text color in Idle?

后端 未结 1 1504
孤独总比滥情好
孤独总比滥情好 2021-01-24 04:29

Is there a way to specify the color a text is printed within Idle for Python 3.2?

I\'m looking for something like:

print(\"foo\", \"#fafafa\")
print(\"ba         


        
相关标签:
1条回答
  • 2021-01-24 04:39

    http://docs.python.org/library/idle.html#syntax-colors

    To change the color scheme, edit the [Colors] section in config.txt.

    Edit: As you've edited your question, here is an edited answer. See

    http://www.daimi.au.dk/~mailund/scripting2005/lecture-notes/process-management.html

    for how to use terminal escape sequences in Python to change the color of things.

    Will they work in IDLE? I don't know. But they will work in most terminals.

    0 讨论(0)
提交回复
热议问题