python - how to delete text to end of line with curses -


how how delete text end of line ?

stdscr.addstr(5, 5, "egestas curabitur phasellus magnis") 

result screen: egestas curabitur phasellus magnis # ok

stdscr.addstr(5, 5, "elit metus") 

result screen: elit metusrabitur phasellus magnis # problem

to delete eol (end of line) use window.clrtoeol():

example:

import curses  window = curses.initscr() window.clrtoeol() window.refresh() 

i recommend use of great urwid console/tui programming however.

update: bhargav rao right however; have call window.refresh() explicitly:

accordingly, curses requires explicitly tell redraw windows, using refresh() method of window objects. in practice, doesn’t complicate programming curses much. programs go flurry of activity, , pause waiting keypress or other action on part of user. have sure screen has been redrawn before pausing wait user input, calling stdscr.refresh() or refresh() method of other relevant window.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -