Tha*_*tos 8 python curses ncurses
在彩色模式下,我似乎无法在诅咒中工作.如果我不打电话start_color,我就会变黑了.我打电话的时候start_color,事情开始以黑灰色输出.
如果您运行此脚本:
import sys
for i in xrange(30, 38):
print '\x1b[0;' + str(i) + 'm' + str(i) + ': Shiny colors \x1b[1m(bright)'
print '\x1b[0m...and this is normal.'
Run Code Online (Sandbox Code Playgroud)
......你可能会看到很多漂亮的颜色.我想要但不能得到的是最后一句话:"......这是正常的." 要求颜色对0或要求COLOR_WHITE,COLOR_BLACK从脚本中获取非亮#37.
作为参考,这是我在Gnome终端中看到的:
http://rpi.edu/~wellir/random/colors.png
我用Python编程(使用curses库),所以我的代码是这样的:
import curses
screen = curses.initscr()
curses.start_color()
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
screen.clear()
screen.attrset(0)
screen.addstr('Hello')
screen.attrset(curses.A_BOLD)
screen.addstr('Hello')
screen.attrset(curses.color_pair(1))
screen.addstr('Hello')
screen.refresh()
curses.napms(5000)
curses.endwin()
Run Code Online (Sandbox Code Playgroud)
......让我37,37-亮,37.
| 归档时间: |
|
| 查看次数: |
2256 次 |
| 最近记录: |