简体   繁体   中英

Python / Curses - How to print separate items?

this code the result screen: foobar (OK)

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

this code the result screen: foobar (OK)

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

But how to get the result screen fo ob ar ?

Please consult anyone? Thank you.

Just split this into more than one addstr() call. 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'. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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