本文整理匯總了Python中curses.flushinp方法的典型用法代碼示例。如果您正苦於以下問題:Python curses.flushinp方法的具體用法?Python curses.flushinp怎麽用?Python curses.flushinp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類curses
的用法示例。
在下文中一共展示了curses.flushinp方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: edit
# 需要導入模塊: import curses [as 別名]
# 或者: from curses import flushinp [as 別名]
def edit(self):
self.editing = True
self.how_exited = None
# if self.value: self.cursor_line = self.value
self.display()
while self.editing:
self.get_and_use_key_press()
self.update(clear=None)
## self.clear()
## self.update(clear=False)
self.parent.refresh()
## curses.napms(10)
## curses.flushinp()
示例2: notify_wait
# 需要導入模塊: import curses [as 別名]
# 或者: from curses import flushinp [as 別名]
def notify_wait(*args, **keywords):
notify(*args, **keywords)
curses.napms(3000)
curses.flushinp()
示例3: h_display_help
# 需要導入模塊: import curses [as 別名]
# 或者: from curses import flushinp [as 別名]
def h_display_help(self, input):
if self.help == None: return
if self.name:
help_name="%s Help" %(self.name)
else: help_name=None
curses.flushinp()
util_viewhelp.view_help(self.help, title=help_name, autowrap=self.WRAP_HELP)
#select.ViewText(self.help, name=help_name)
self.display()
return True
示例4: main
# 需要導入模塊: import curses [as 別名]
# 或者: from curses import flushinp [as 別名]
def main(screen):
init_curses(screen)
game_map = Map("map1")
player = Player(game_map)
textures = ["wall1", "wall2", "dragon", "tree"]
Controller(Renderer(screen, player, textures)).start()
curses.flushinp()
curses.endwin()
示例5: edit
# 需要導入模塊: import curses [as 別名]
# 或者: from curses import flushinp [as 別名]
def edit(self):
self.editing = True
self.how_exited = None
#if self.value: self.cursor_line = self.value
self.display()
while self.editing:
self.get_and_use_key_press()
self.update(clear=None)
## self.clear()
## self.update(clear=False)
self.parent.refresh()
## curses.napms(10)
## curses.flushinp()
示例6: get_and_use_key_press
# 需要導入模塊: import curses [as 別名]
# 或者: from curses import flushinp [as 別名]
def get_and_use_key_press(self):
global TEST_SETTINGS
if (TEST_SETTINGS['TEST_INPUT'] is None) and (TEST_SETTINGS['INPUT_GENERATOR'] is None):
curses.raw()
curses.cbreak()
curses.meta(1)
self.parent.curses_pad.keypad(1)
if self.parent.keypress_timeout:
curses.halfdelay(self.parent.keypress_timeout)
ch = self._get_ch()
if ch == -1:
return self.try_while_waiting()
else:
self.parent.curses_pad.timeout(-1)
ch = self._get_ch()
# handle escape-prefixed rubbish.
if ch == curses.ascii.ESC:
#self.parent.curses_pad.timeout(1)
self.parent.curses_pad.nodelay(1)
ch2 = self.parent.curses_pad.getch()
if ch2 != -1:
ch = curses.ascii.alt(ch2)
self.parent.curses_pad.timeout(-1) # back to blocking mode
#curses.flushinp()
elif (TEST_SETTINGS['INPUT_GENERATOR']):
self._last_get_ch_was_unicode = True
try:
ch = next(TEST_SETTINGS['INPUT_GENERATOR'])
except StopIteration:
if TEST_SETTINGS['CONTINUE_AFTER_TEST_INPUT']:
TEST_SETTINGS['INPUT_GENERATOR'] = None
return
else:
raise ExhaustedTestInput
else:
self._last_get_ch_was_unicode = True
try:
ch = TEST_SETTINGS['TEST_INPUT'].pop(0)
TEST_SETTINGS['TEST_INPUT_LOG'].append(ch)
except IndexError:
if TEST_SETTINGS['CONTINUE_AFTER_TEST_INPUT']:
TEST_SETTINGS['TEST_INPUT'] = None
return
else:
raise ExhaustedTestInput
self.handle_input(ch)
if self.check_value_change:
self.when_check_value_changed()
if self.check_cursor_move:
self.when_check_cursor_moved()
self.try_adjust_widgets()