本文整理汇总了Python中curses.textpad.Textbox.edit方法的典型用法代码示例。如果您正苦于以下问题:Python Textbox.edit方法的具体用法?Python Textbox.edit怎么用?Python Textbox.edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类curses.textpad.Textbox
的用法示例。
在下文中一共展示了Textbox.edit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_edit_box
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def draw_edit_box(menu_man, win_man, build_opts):
## BUGGY (resize + too small windows not handled properly)
win_man.resize_wins("edit_mode")
win_man.refresh_all()
curses.curs_set(1)
# Add title of the box
win_man._field_win.bkgd(" ", curses.color_pair(5))
win_man._field_win.addstr(0, 0, menu_man.get_verbose_cur_field(), curses.color_pair(5))
win_man._field_win.chgat(0, 0, -1, curses.color_pair(1))
# Create the window that will holds the text
(YMAX, XMAX) = win_man._field_win.getmaxyx()
(YBEG, XBEG) = win_man._field_win.getparyx()
text_win = curses.newwin(YMAX, XMAX, YBEG + 6, XBEG + 5)
text_win.bkgd(" ", curses.color_pair(5))
text_win.addstr(0, 0, build_opts[menu_man._cur_field], curses.color_pair(5))
# Refresh both windows
win_man._field_win.noutrefresh()
text_win.noutrefresh()
curses.doupdate()
# Create a textbox
box = Textbox(text_win)
box.edit()
build_opts[menu_man._cur_field] = box.gather()[:-2]
del text_win
curses.curs_set(0)
menu_man._cur_field = ""
win_man.resize_wins("menu_mode")
示例2: main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main(stdscr):
curses.noecho()
curses.cbreak()
stdscr.keypad(1)
rT = threading.Thread(target=receiving, args=("RecvThread", s))
rT.start()
put = curses.newwin(4, 66, 20, 0)
put.border(0)
put.addstr(1, 1, nick+' >> ')
put.addstr(3, 1, 'Enter to send------------------------------------------q to exit')
put.refresh()
boxbox = curses.newwin(1, 51, 21, 14)
boxbox.refresh()
box = Textbox(boxbox)
message = ''
while message != 'q ':
box.edit()
message = str(box.gather())
if message != '':
s.sendto(nick + " >> " + message, server)
boxbox.clear()
time.sleep(0.2)
s.sendto('3 '+nick, server)
示例3: main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main() :
choice = raw_input("Enter filename : ")
screen = curses.initscr()
curses.noecho()
with open(choice, 'w+') as rf:
filedata = rf.read()
editwin = curses.newwin(20,70, 2,1)
editwin.addstr(1,1,filedata)
rectangle(screen, 1,0, 1+20+1, 1+70+1)
screen.refresh()
box = Textbox(editwin)
# Let the user edit until Ctrl-G is struck.
box.edit()
# Get resulting contents
message = box.gather()
curses.endwin()
with open(choice,'w+') as wf:
wf.write(message)
示例4: main_control
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main_control(screen, event, inception_level):
if event == ord("Q"):
curses.endwin()
exit(0)
if event == ord("D"):
window_for_done_task(screen)
if event == ord("T"):
window_for_undone_task(screen)
if event == ord("F"):
curses.flash()
if event == ord("A"):
editwin = curses.newwin(1,
screen.getmaxyx()[1]-6,
screen.getmaxyx()[0]-4,
1
)
rectangle(screen,
screen.getmaxyx()[0]-5,
0, screen.getmaxyx()[0]-3,
screen.getmaxyx()[1]-5)
screen.refresh()
box = Textbox(editwin)
# Let the user edit until Ctrl-G is struck.
box.edit()
# Get resulting contents
message = box.gather()
Tache().ajouter_tache(message, datetime.now())
screen.clear()
print_main_screen(screen)
print_taches(screen, Tache().get_tache_undone(), "Taches a faire :")
deal_with_selected(screen, 33, 45, Tache().get_tache_undone(),
window_for_undone_task)
示例5: _display
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def _display(self, text=None, edit=True):
self._window.refresh()
self._window.border()
text_width = self._width - 2
text_height = self._height - 2
self._window.addstr(0, 1, "[%s]" % "Your answer"[0:text_width - 2])
self._window.addstr(self._height - 1, text_width - 8, "[Ctrl+G]")
#self._window.move(1,1)
self._window.refresh()
if edit:
temporary_edit_window = curses.newwin(text_height, text_width, self._y + 1, self._x + 1)
curses.curs_set(True)
edit_box = Textbox(temporary_edit_window)
edit_box.edit()
curses.curs_set(False)
content = edit_box.gather().strip()
del temporary_edit_window
return content
else:
return None
示例6: _main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def _main(self, stdscr):
try:
# stdscr = curses.initscr()
# Clear screen
stdscr.clear()
# remove the cursor
curses.curs_set(True)
# remove echo from touched keys
# curses.noecho()
self._initPanels(stdscr)
box = Textbox(self.commandInput)
# stdscr.refresh()
th = Thread(target = self.refreshProbes, name = "Probe-Refresh", daemon = True)
th.start()
stdscr.refresh()
while self.isRunning:
stdscr.refresh()
box.edit()
self.doCommand(box.gather())
# commandInput.refresh()
# listen without entering enter
# curses.cbreak())
finally:
self.isRunning = False
th.join()
# let curses handle special keys
stdscr.keypad(True)
stdscr.refresh()
stdscr.getkey()
示例7: main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main(stdscr):
curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)
curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLUE )
#curses.noecho()
#curses.curs_set(0)
#stdscr.clear()
#stdscr.resize(50, 50)
#stdscr.border(0)
#x=input("...waiting..")
#curses.endwin()
stdscr.border(0)
stdscr.refresh()
stdscr_y = curses.LINES - 1
stdscr_x = curses.COLS - 1
drawCoor(stdscr)
pad = curses.newpad(20, 20)
pad2 = curses.newpad(20, 20)
for y in range(0, 19):
for x in range(0, 19):
pad.addch(y,x, ord('a') + (x*x+y*y) % 26)
for y in range(0, 19):
for x in range(0, 19):
pad2.addch(y,x, ord('-'))
pad.border(0)
pad2.border(0)
pad2.refresh(0,0, 15,5, 65,30)
pad.refresh(0,0, 5,15, 30,40)
stdscr.refresh()
stdscr.addstr(15, 50,"Pretty text", curses.color_pair(2))
stdscr.addstr(10, 50, "Current mode: Typing mode", curses.A_REVERSE)
stdscr.addstr(10, 50, "HELLO")
stdscr.refresh()
stdscr.addstr(50, 50, "Enter IM message: (hit Ctrl-G to send)")
rectangle(stdscr, 40,80, 60, 100)
stdscr.refresh()
## Let the user edit until Ctrl-G is struck.
editwin = curses.newwin(10,10, 50,90) # height, width, begin_y, begin_x
stdscr.refresh()
box = Textbox(editwin)
box.edit()
示例8: textbox
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def textbox(nrow, ncol, x, y):
editwin = curses.newwin(nrow,ncol,x,y)
# upleft point x, upleft point y, downright x, downright y
rectangle(scr, x-1, y-1, x + nrow, y + ncol)
scr.refresh()
box = Textbox(editwin)
box.edit()
message = box.gather()
return message
示例9: switch_buffer
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def switch_buffer(self):
"""
prompts to a buffer, opens it
"""
prompt = curses.subwin(1, curses.COLS-1, curses.LINES -1, 0)
prompt.addstr("BUFFER NAME:")
inputbox = Textbox(prompt)
inputbox.edit()
dest = gather(inputbox)
self.open_buffer(dest.split(":")[1])
示例10: textbox
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def textbox(screen):
screen.addstr(0, 0, "Enter IM message: (hit Ctrl-G to send)", curses.A_REVERSE)
editwin = curses.newwin(5, 30, 2, 1)
rectangle(screen, 1, 0, 1+5+1, 1+30+1)
screen.refresh()
box = Textbox(editwin)
box.edit()
message = box.gather()
示例11: drawLoginInput
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def drawLoginInput(screen, height, width):
dramaticOutput(screen, height//2, width//2, 'Enter your handle:', 0.05)
handleWindow = curses.newwin(1, 30, height//2+1, width//2 - 16)
handleBox = Textbox(handleWindow)
handleBox.edit()
handle = handleBox.gather()
screen.clear()
dramaticOutput(screen, height//2, width//2, 'Logging you in as ' + handle + '...', 0.05)
time.sleep(1)
return handle
示例12: main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main(output):
ouput = curses.initscr()
field = curses.newwin(2, curses.COLS, curses.LINES - 3, 0)
curses.start_color()
curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK)
curses.init_pair(2, curses.COLOR_BLACK, curses.COLOR_YELLOW)
output.bkgd(curses.color_pair(1))
field.bkgd(curses.color_pair(2))
box = Textbox(field)
box.edit()
示例13: main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main(stdscr):
stdscr = curses.initscr()
stdscr.clear()
stdscr.addstr(0, 0, "JukeBox - v.0.1 'dancing Saci'")
editwin = curses.newwin(5,30, 2,1)
rectangle(stdscr, 1,0,1+5+1, 1+30+1)
stdscr.refresh()
box = Textbox(editwin)
box.edit()
message = box.gather()
示例14: main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main(stdscr):
stdscr.clear()
columns = split_into_columns(stdscr,3)
shouldExit = False
box = Textbox(columns[0])
rect = rectangle(columns[0],5,5,0,0)
while not shouldExit:
box.edit()
k = stdscr.getkey()
if k == "q":
shouldExit = True
示例15: main
# 需要导入模块: from curses.textpad import Textbox [as 别名]
# 或者: from curses.textpad.Textbox import edit [as 别名]
def main(stdscr):
stdscr.addstr(0, 0, "Enter IM message: (hit Ctrl-G to send)")
editwin = curses.newwin(30,30, 30, 30)
rectangle(stdscr, 20, 20, 1+5+1, 1+30+1)
stdscr.refresh()
box = Textbox(editwin)
# Let the user edit until Ctrl-G is struck.
box.edit()
# Get resulting contents
message = box.gather()