1
如何更新屏幕或同時等待密鑰?我使用Python的unicurses,但我想我會在C. 同樣的問題,這是我想要的僞代碼來完成:使用curses,我如何更新屏幕或等待密鑰?
function startScreen(){
stdscr = initscr()
while True{
- Update screen using a variable that is constantly changing (probably by a thread, right?)
- Get a key with getch() - to close or interact with the screen
}
}
我的問題是,屏幕不更新,除非有事如調整屏幕大小或按下某個鍵。我正在考慮使用while循環(和time.sleep(1)?)來更新屏幕和一個線程來等待鍵。那可能嗎?我不太瞭解線程,這就是爲什麼我問。有一種更簡單的方法嗎?
謝謝。
完美!非常感謝你! – SadSeven