本文整理汇总了Python中curses.KEY_F10属性的典型用法代码示例。如果您正苦于以下问题:Python curses.KEY_F10属性的具体用法?Python curses.KEY_F10怎么用?Python curses.KEY_F10使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类curses
的用法示例。
在下文中一共展示了curses.KEY_F10属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: modal
# 需要导入模块: import curses [as 别名]
# 或者: from curses import KEY_F10 [as 别名]
def modal(self):
"""run the modal getch-loop for this dialog"""
if self.win:
done = False
while not done:
key_pressed = self.win.getch()
if key_pressed in [27, ord("q"), curses.KEY_F10]:
done = True
if key_pressed == curses.KEY_DOWN:
self.down(1)
if key_pressed == curses.KEY_UP:
self.down(-1)
if key_pressed in [curses.KEY_IC, ord("=")]:
self.toggle_select()
self.down(1)
for key, func in self.dlg_keys:
if key == key_pressed:
func()
done = True
# help the garbage collector clean up circular references
# to make sure __del__() will be called to close the dialog
del self.dlg_keys
示例2: validator
# 需要导入模块: import curses [as 别名]
# 或者: from curses import KEY_F10 [as 别名]
def validator(self, char):
"""here we tweak the behavior slightly, especially we want to
end modal editing mode immediately on arrow up/down and on enter
and we also want to catch ESC and F10, to abort the entire dialog"""
if curses.ascii.isprint(char):
return char
if char == curses.ascii.TAB:
char = curses.KEY_DOWN
if char in [curses.KEY_DOWN, curses.KEY_UP]:
self.result = char
return curses.ascii.BEL
if char in [10, 13, curses.KEY_ENTER, curses.ascii.BEL]:
self.result = 10
return curses.ascii.BEL
if char == 127:
char = curses.KEY_BACKSPACE
if char in [27, curses.KEY_F10]:
self.result = -1
return curses.ascii.BEL
return char