def keypress(self, size, key):
if key == 'enter':
# if you dont need a reference to the CustomEdit instance you can drop the 3rd argument
self.on_finish(self)
return
elif key == 'esc':
super(CustomEdit, self).set_edit_text('')
self.on_finish(self)
return
return urwid.Edit.keypress(self, size, key)
评论列表
文章目录