本文整理汇总了Python中curses.noecho方法的典型用法代码示例。如果您正苦于以下问题:Python curses.noecho方法的具体用法?Python curses.noecho怎么用?Python curses.noecho使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses
的用法示例。
在下文中一共展示了curses.noecho方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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: init_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [as 别名]
def init_curses():
window = curses.initscr()
curses.noecho() # prevents user input from being echoed
curses.curs_set(0) # make cursor invisible
curses.start_color()
curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK)
curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
curses.init_pair(4, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
curses.init_pair(5, curses.COLOR_YELLOW, curses.COLOR_BLACK)
window.timeout(50)
window.keypad(1) # interpret arrow keys, etc
return window
示例3: wrapper_basic
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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()
示例4: wrapper_fork
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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)
示例5: init_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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)
示例6: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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
示例7: _init_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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()
示例8: get_input
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [as 别名]
def get_input(self, prompt):
"""Get user input through the user interface and return it."""
curses.curs_set(2)
self.prompt_area.clear()
self.input_prompt.addstr(0, 0, prompt)
self.search_window.clear()
self.prompt_area.refresh()
curses.echo()
user_input = self.search_window.getstr().decode(encoding="utf-8")
curses.noecho()
self.prompt_area.clear()
self.prompt_area.refresh()
curses.curs_set(0)
return user_input
示例9: pg_top
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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
示例10: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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'
)
示例11: setup_curses
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [as 别名]
def setup_curses():
"""Setup terminal/curses state."""
window = curses.initscr()
curses.noecho()
window = curses.newwin(
WINDOW_HEIGHT + (VERT_PADDING * 2),
WINDOW_WIDTH + (HORIZ_PADDING * 2),
WINDOW_TOP - VERT_PADDING,
WINDOW_LEFT - HORIZ_PADDING,
)
curses.start_color()
global _COLOR_PAIRS
_COLOR_PAIRS = {}
for i, (k, v) in enumerate(COLOR_MAP.items(), 1):
curses.init_pair(i, v, curses.COLOR_BLACK)
_COLOR_PAIRS[k] = curses.color_pair(i)
return window
示例12: setup
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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()
示例13: get_int_value
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [as 别名]
def get_int_value(self, message):
dimensions = self.screen.getmaxyx()
if len(message) < dimensions[1]:
empty = dimensions[1] - len(message) - 2
self.screen.addstr(dimensions[0] - 2, len(message) + 1, \
" " * empty, curses.A_STANDOUT)
self.screen.addstr(dimensions[0] - 2, 1, message, curses.A_STANDOUT)
curses.curs_set(1);
curses.echo() # show cursor
value = self.screen.getstr()
self.draw_help()
curses.curs_set(0);
curses.noecho()
try:
return int(value)
except ValueError:
return None
示例14: _init_screen
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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
示例15: __init__
# 需要导入模块: import curses [as 别名]
# 或者: from curses import noecho [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()