當前位置: 首頁>>代碼示例>>Python>>正文


Python curses.cbreak方法代碼示例

本文整理匯總了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...") 
開發者ID:mcardillo55,項目名稱:cbpro-trader,代碼行數:19,代碼來源:cursesDisplay.py

示例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() 
開發者ID:hexway,項目名稱:apple_bleee,代碼行數:18,代碼來源:npyssafewrapper.py

示例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) 
開發者ID:hexway,項目名稱:apple_bleee,代碼行數:27,代碼來源:npyssafewrapper.py

示例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) 
開發者ID:Macr0phag3,項目名稱:email_hack,代碼行數:22,代碼來源:CLI.py

示例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 
開發者ID:hash3liZer,項目名稱:airpydump,代碼行數:19,代碼來源:airpydump.py

示例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() 
開發者ID:yihong0618,項目名稱:gaycore,代碼行數:18,代碼來源:gcore_box.py

示例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() 
開發者ID:flux3dp,項目名稱:fluxclient,代碼行數:18,代碼來源:console.py

示例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 
開發者ID:virtuozzo,項目名稱:postgresql-perf-tools,代碼行數:22,代碼來源:pg-top.py

示例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'
        ) 
開發者ID:dw,項目名稱:mitogen,代碼行數:18,代碼來源:mitop.py

示例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() 
開發者ID:spec-sec,項目名稱:SecureChat,代碼行數:19,代碼來源:cli.py

示例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 
開發者ID:asottile,項目名稱:babi,代碼行數:22,代碼來源:screen.py

示例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() 
開發者ID:Battelle,項目名稱:sandsifter,代碼行數:36,代碼來源:sifter.py

示例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() 
開發者ID:Battelle,項目名稱:sandsifter,代碼行數:14,代碼來源:gui.py

示例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 
開發者ID:dobin,項目名稱:ffw,代碼行數:11,代碼來源:gui.py

示例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() 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:13,代碼來源:curses_ui.py


注:本文中的curses.cbreak方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。