attributeError:模块' cursess'没有属性' a_italic'
由于某种原因,我无法确定为什么诅咒不会让我使用 a_italic
属性。
所有其他属性似乎都没有问题,但斜体特异性触发了错误消息。
我正在运行Python 3.10.4,这里有一些示例代码:
import curses
def main(stdscr):
stdscr.addstr(0, 0, "This should be italicized!", curses.A_ITALIC)
stdscr.getch()
if __name__ == '__main__':
curses.wrapper(main)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MacOS上的Python可以支持
A_ITALIC
如果它是使用Ncurses的最新版本构建的(因为 2013 ,例如,ncurses 6.x)。 MacOS的Ncurses的系统版本太旧了。python在其他平台上也是如此,例如, netbsd 和旧版Unix系统。
使用python的最新版本,您可以使用版本 或 ncurses_version 函数。但是,即使有了最近的Ncurses版本,python中总会有可能会干扰该功能的错误。
python的质疑包装器(请参阅
更改基础ncurs不会影响这一点(除非Python重建)。
Python on MacOS could support
A_ITALIC
if it is built using a recent version of ncurses (since 2013, e.g., ncurses 6.x). The system version of ncurses for MacOS is far too old for that.The same applies to Python on other platforms, e.g., NetBSD and legacy Unix systems.
With correspondingly recent versions of Python, you can check which version of ncurses using the
version
or thencurses_version
function. However, even with a recent ncurses version, there's always the possibility of a bug in Python which interferes with providing that feature.Python's curses wrapper (see source) knows about the feature because its name is compiled-in when Python is built:
Changing the underlying ncurses would not affect that (unless Python is rebuilt).
来自
curss
curses document ::我在MacOS上尝试了Python 3.9.12,但它不起作用,但是它确实使用了Docker容器中的Python 3.10.4使用。
From the
curses
documentation:I tried it in Python 3.9.12 on macOS, and it didn't work, but it did work using Python 3.10.4 in a Docker container.