I'm using curses in python 3.5.9/raspian on a raspberry pi 3b+. I put up a simple window with a one line input field using the curses.textpad module. I also have a clock on the screen in another curses window; it's running in a thread of its own.
When the textpad comes up, the clock disappears. When I type in the text pad, the first character causes the clock to reappear, but it doesn't update, and appears to have stopped. Each subsequent character entered causes the clock to update, but only once per character. I don't believe the clock thread is being blocked. I think the textpad object is not updating the main window when it isn't receiving characters. The questions is, how do I get the screen to refresh while there's a textpad blocking on user input? Here is a pared down bit of code:
... self.uiwin = curses.newwin(self.y,self.x,self.ybegin,int((curses.COLS-self.x)/2)) # small win. ... entrywin = self.uiwin.derwin(1,windowlength,2,windowpadding) # make a 1 line input field. entryfield = curses.textpad.Textbox(entrywin) entryfield.edit(self.__terminate_entry) entry = entryfield.gather() ...
...and the terminate_entry method is:
def __terminate_entry(self,ch): '''Replace tabs, linefeeds, formfeeds, carriage returns with ctrl+g''' if ch in (9,10,11,12,13,27,curses.KEY_BTAB): return 7 # ctrl+g terminates the textpad. else: return ch # otherwise pass the character through.
Thanks in advance for any suggestions/ideas.