本文整理汇总了Python中curses.cbreak方法的典型用法代码示例。如果您正苦于以下问题:Python curses.cbreak方法的具体用法?Python curses.cbreak怎么用?Python curses.cbreak使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.cbreak方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def __init__(self, enable=True):
self.enable = enable
if not self.enable:
return
self.logger = logging.getLogger('trader-logger')
self.stdscr = curses.initscr()
self.pad = curses.newpad(23, 120)
self.order_pad = curses.newpad(10, 120)
self.timestamp = ""
self.last_order_update = 0
curses.start_color()
curses.noecho()
curses.cbreak()
curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_GREEN)
curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_RED)
self.stdscr.keypad(1)
self.pad.addstr(1, 0, "Waiting for a trade...")
示例2: wrapper_basic
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def wrapper_basic(call_function):
#set the locale properly
locale.setlocale(locale.LC_ALL, '')
return curses.wrapper(call_function)
#def wrapper(call_function):
# locale.setlocale(locale.LC_ALL, '')
# screen = curses.initscr()
# curses.noecho()
# curses.cbreak()
#
# return_code = call_function(screen)
#
# curses.nocbreak()
# curses.echo()
# curses.endwin()
示例3: wrapper_fork
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def wrapper_fork(call_function, reset=True):
pid = os.fork()
if pid:
# Parent
os.waitpid(pid, 0)
if reset:
external_reset()
else:
locale.setlocale(locale.LC_ALL, '')
_SCREEN = curses.initscr()
try:
curses.start_color()
except:
pass
_SCREEN.keypad(1)
curses.noecho()
curses.cbreak()
curses.def_prog_mode()
curses.reset_prog_mode()
return_code = call_function(_SCREEN)
_SCREEN.keypad(0)
curses.echo()
curses.nocbreak()
curses.endwin()
sys.exit(0)
示例4: init_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def init_curses(self):
"""Setup the curses"""
self.window = curses.initscr()
self.height, self.width = self.window.getmaxyx()
if self.width < 60:
self.too_small = True
return
self.window.keypad(True)
# self.window.nodelay(True)
curses.noecho()
curses.curs_set(False)
curses.cbreak()
curses.start_color()
curses.init_pair(1, curses.COLOR_RED, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_YELLOW, curses.COLOR_BLACK)
curses.init_pair(3, curses.COLOR_WHITE, curses.COLOR_BLACK)
curses.init_pair(4, curses.COLOR_GREEN, curses.COLOR_BLACK)
curses.init_pair(5, curses.COLOR_WHITE, curses.COLOR_CYAN)
示例5: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def __init__(self, scanner):
self.scanner = scanner
self.screen = curses.initscr()
curses.noecho()
curses.cbreak()
self.screen.keypad(1)
self.screen.scrollok(True)
self.x, self.y = self.screen.getmaxyx()
curses.start_color()
curses.use_default_colors()
try:
self.screen.curs_set(0)
except:
try:
self.screen.curs_set(1)
except:
pass
示例6: _init_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def _init_curses(self):
self.stdscr = curses.initscr()
self.stdscr.keypad(1)
curses.noecho()
curses.cbreak()
curses.curs_set(0)
curses.start_color()
try:
curses.init_pair(1, curses.COLOR_BLACK, 197) # 接近机核主题的颜色
except:
# 树莓派 windows无法使用机核like色
curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_RED)
curses.init_pair(2, curses.COLOR_WHITE, curses.COLOR_BLACK)
self.stdscr.bkgd(curses.color_pair(2))
self.stdscr.timeout(100)
self.stdscr.refresh()
示例7: setup
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def setup(self):
curses.start_color()
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
curses.cbreak()
curses.echo()
lines, cols = self.stdscr.getmaxyx()
self.logwin = self.stdscr.subwin(lines - 2, cols, 0, 0)
self.sepwin = self.stdscr.subwin(1, cols, lines - 2, 0)
self.cmdwin = self.stdscr.subwin(1, cols, lines - 1, 0)
self.logwin.scrollok(True)
self.sepwin.bkgd(curses.color_pair(1))
self.sepwin.refresh()
示例8: pg_top
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def pg_top(scr, pgt, con, opts):
curses.noecho() # disable echo
curses.cbreak() # keys are read directly, without hitting Enter
# curses.curs_set(0) # disable mouse
pgt.init(scr, con, opts)
t = threading.Thread(target=main_loop, args=(pgt,))
t.daemon = True
t.start()
while 1:
try:
key = pgt.getkey()
if key == 'q':
pgt.terminate = True
break
except KeyboardInterrupt:
break
pgt.terminate = True
示例9: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def __init__(self, hosts):
self.stdscr = curses.initscr()
curses.start_color()
self.height, self.width = self.stdscr.getmaxyx()
curses.cbreak()
curses.noecho()
self.stdscr.keypad(1)
self.hosts = hosts
self.format = (
'%(hostname)10.10s '
'%(pid)7.7s '
'%(ppid)7.7s '
'%(pcpu)6.6s '
'%(rss)5.5s '
'%(command)20s'
)
示例10: setup
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def setup(self):
"""
Perform basic command-line interface setup.
"""
curses.curs_set(1)
curses.noecho()
curses.cbreak()
# Keypad disabled until scrolling properly implemented
# self.stdscr.keypad(True)
self.stdscr.clear()
self.stdscr.addstr("SecureChat v{}".format(__version__))
self.chat_container.box()
self.chat_win.addstr("Welcome to SecureChat!")
self.chat_win.scrollok(True)
self.chat_win.setscrreg(0, self.max_y - 5)
self.prompt_win.addstr("> ")
self.refresh_all()
示例11: _init_screen
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def _init_screen() -> 'curses._CursesWindow':
# set the escape delay so curses does not pause waiting for sequences
if sys.version_info >= (3, 9): # pragma: no cover
curses.set_escdelay(25)
else: # pragma: no cover
os.environ.setdefault('ESCDELAY', '25')
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
# <enter> is not transformed into '\n' so it can be differentiated from ^J
curses.nonl()
# ^S / ^Q / ^Z / ^\ are passed through
curses.raw()
stdscr.keypad(True)
with contextlib.suppress(curses.error):
curses.start_color()
curses.use_default_colors()
return stdscr
示例12: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def __init__(self, ts, injector, tests, do_tick, disassembler=disas_capstone):
self.ts = ts;
self.injector = injector
self.T = tests
self.gui_thread = None
self.do_tick = do_tick
self.ticks = 0
self.last_ins_count = 0
self.delta_log = deque(maxlen=self.RATE_Q)
self.time_log = deque(maxlen=self.RATE_Q)
self.disas = disassembler
self.stdscr = curses.initscr()
curses.start_color()
# doesn't work
# self.orig_colors = [curses.color_content(x) for x in xrange(256)]
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.curs_set(0)
self.stdscr.nodelay(1)
self.sx = 0
self.sy = 0
self.init_colors()
self.stdscr.bkgd(curses.color_pair(self.WHITE))
self.last_time = time.time()
示例13: start
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def start(self, no_delay):
self.window = curses.initscr()
curses.start_color()
curses.use_default_colors()
curses.noecho()
curses.cbreak()
curses.curs_set(0)
self.window.nodelay(no_delay)
self.init_colors()
self.window.bkgd(curses.color_pair(self.WHITE))
locale.setlocale(locale.LC_ALL, '') # set your locale
self.code = locale.getpreferredencoding()
示例14: initCurses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def initCurses():
screen = curses.initscr()
curses.noecho() # disable the keypress echo to prevent double input
curses.cbreak() # disable line buffers to run the keypress immediately
curses.curs_set(0)
screen.keypad(1) # enable keyboard use
screen.addstr(1, 2, "Fuzzing For Worms", curses.A_UNDERLINE)
return screen
示例15: _screen_launch
# 需要导入模块: import curses [as 别名]
# 或者: from curses import cbreak [as 别名]
def _screen_launch(self, enable_mouse_on_start):
"""Launch the curses screen."""
curses.noecho()
curses.cbreak()
self._stdscr.keypad(1)
self._mouse_enabled = enable_mouse_on_start
self._screen_set_mousemask()
self._screen_create_command_window()