Change printed text color in Idle?

China☆狼群 提交于 2019-12-04 05:03: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("bar", "#4f4f4f")

回答1:


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.



来源:https://stackoverflow.com/questions/6795330/change-printed-text-color-in-idle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!