Python curses.KEY_F10 Examples
The following are 3
code examples of curses.KEY_F10().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
curses
, or try the search function
.
Example #1
Source File: pytrader.py From pytrader with MIT License | 6 votes |
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
Example #2
Source File: pytrader.py From pytrader with MIT License | 6 votes |
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
Example #3
Source File: pytrader.py From pytrader with MIT License | 5 votes |
def validator(self, char): """allow only numbers to be entered""" if char == ord("q"): char = curses.KEY_F10 if curses.ascii.isprint(char): if chr(char) not in "0123456789.": char = 0 return TextBox.validator(self, char)