我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用curses.beep()。
def default_menu(self): submenu_items = [ ('beep', curses.beep), ('flash', curses.flash), ('stringy', "stringgggg"), ] submenu = CursesMenuPanel(items=submenu_items, rootmenu=self) #return submenu main_menu_items = [ ('beep', curses.beep), ('flash', curses.flash), ('submenu', submenu), ('submenutype', submenu.__class__.__name__), ('stringy', "stringgggg") ] main_menu = CursesMenuPanel(items=main_menu_items, rootmenu=self) return main_menu
def run(self): opt = 'x' while True: self.draw(opt) opt = self.screen.getch() # curses.flushinp() # flush input # arrow keys seem to send [27, 66], where the first is ESC # you really want the second number if opt == self.DOWN_KEY: curses.flash() # return elif opt == self.UP_KEY: curses.flash() # return elif opt == self.RIGHT_KEY: curses.flash() # return elif opt == self.LEFT_KEY: curses.flash() # return elif opt == self.SPACE_KEY: curses.flash() # elif opt == self.ESC_KEY or opt == ord('q'): elif opt == ord('q'): # curses.beep() # curses.flash() return # else: # curses.flash() # else: # self.screen.addstr(13, 30, 'key {}'.format(opt)) # time.sleep(1)
def look_out(msecs): curses.napms(msecs) if stdscr.getch() != -1: curses.beep() sys.exit(0)
def whenJustBeep(self): curses.beep()