简体   繁体   English

Python /诅咒-如何打印单独的项目?

[英]Python / Curses - How to print separate items?

this code the result screen: foobar (OK) 此代码将显示结果屏幕:foobar(确定)

stdscr.addstr(10, 10, "foobar")

this code the result screen: foobar (OK) 此代码将显示结果屏幕: foob​​ar (确定)

stdscr.addstr(10, 10, "foobar", curses.A_REVERSE)

But how to get the result screen fo ob ar ? 可是如何才能让结果屏幕FO OB AR?

Please consult anyone? 请咨询任何人? Thank you. 谢谢。

Just split this into more than one addstr() call. 只需将其拆分为多个addstr()调用即可。 For example: 例如:

stdscr.addstr(10, 10, 'fo..ar')
stdscr.addstr(10, 12, 'ob', curses.A_REVERSE)

Instead of the dots you can use spaces. 可以使用空格代替点。 The dots make it easier to see how many characters are between 'fo' and 'ar'. 点使您更容易查看“ fo”和“ ar”之间有多少个字符。 If the cursor position at the end of the output is important either split the output into three function calls in the order the text parts should appear or set the cursor position explicitly after adding the text. 如果输出末尾的光标位置很重要,则可以按照文本部分应显示的顺序将输出分为三个函数调用,或者在添加文本后显式设置光标位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM