Python诅咒没有包装的颜色

时间:2018-08-30 16:33:04

标签: python colors python-asyncio curses

我有问题。我在Windows 10上使用python 3.6.5和curses 2.2 + utf8。我无法使用Windows 10的Linux子系统,我的应用程序需要可移植性。

我的最终目标是获得curses颜色功能。

我有一个需要使用Asyncio和curses的python应用程序,并且成功使用了它,但是curses的包装函数不适用于Asyncio。如何仅通过curses调用手动设置Windows(然后恢复为正常)?我不需要惊人的错误处理就可以尝试捕获,除非需要执行任何操作。最后,大部分情况下这将是一个封闭源脚本。

我像Asyncio的未来一样设置了诅咒,在此之前声明了stdscr。

asyncio.ensure_future(ScreenCoro(stdscr))

通话

async def ScreenCoro(stdscr):
    curses.noecho()
    curses.cbreak()
    stdscr.keypad(True)
    curses.start_color()
    curses.use_default_colors()     ###
    print(curses.COLORS)
    stdscr.refresh()

    curses.curs_set(False)
    stdscr.scrollok(0)
    stdscr.nodelay(1)

    stdscr.refresh()
    Scr.scrBox(stdscr)
    curses.mousemask(curses.ALL_MOUSE_EVENTS)

    curses.mouseinterval(0)
    stdscr.refresh()

    ### code that updates the view, which works apart from color.

谢谢大家的帮助!

0 个答案:

没有答案
相关问题