本文整理汇总了Python中WConio.clreol方法的典型用法代码示例。如果您正苦于以下问题:Python WConio.clreol方法的具体用法?Python WConio.clreol怎么用?Python WConio.clreol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WConio
的用法示例。
在下文中一共展示了WConio.clreol方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _erase
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def _erase(self):
self.written_x = 0
sys.stdout.write ("\r")
if self.OS != 'nt':
sys.stdout.write ("\x1b[0K")
else:
WConio.clreol()
示例2: display_suggestion
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def display_suggestion(msg):
global old_matches
matches = []
if not msg or not msg.strip():
if old_matches != matches:
W.gotoxy(0, C.height - 2)
W.clreol()
old_matches = matches
return
msg = msg.split()[0]
for command in commands:
if command.command.startswith(msg) and not command.hide:
matches.append(command)
if matches:
#limit our match count
matches = matches[:5]
if old_matches != matches:
old_matches = matches
W.gotoxy(0, C.height - 2)
W.clreol()
targetwidth = C.width / len(matches)
W.textcolor(W.DARKGREY)
for command in matches:
W.cputs(('%s (%s)' % (command.command, format_time(command.time, command.time_variable))).center(targetwidth))
return matches
示例3: restore
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def restore():
'''
Keep the terminal usable.
Always performed on exit.
'''
W.clreol()
W.textattr(defaultcolor)
W.setcursortype(1)
示例4: status
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def status(self, y, s):
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
wc.gotoxy(0, y)
wc.movetext(0, y, self.ex, self.ey -1, 0, y+1)
wc.gotoxy(0, y)
wc.textbackground(7)
wc.textcolor(15)
wc.clreol()
wc.cputs(s)
示例5: limpialinea
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def limpialinea():
sys.stdout.write ("\r")
if OS!='nt':
sys.stdout.write ("\x1b[0K")
else:
WConio.clreol()
示例6: get_input
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def get_input():
buf = []
while True:
msg = ''.join(buf)
matches = display_suggestion(msg)
W.gotoxy(0, C.height - 1)
W.clreol()
W.textcolor(W.GREEN)
W.cputs(game.state.current_node.command_prompt + '$ '),
W.textcolor(W.LIGHTGREEN)
W.cputs(msg)
if matches and len(matches) == 1:
#show the argument help text
match = matches[0]
x = W.wherex()
W.textcolor(W.DARKGREY)
splitted = match.arguments.split()
splitted = splitted[max(0, len(msg.split())-2):]
W.cputs(' ' + ' '.join(splitted))
W.textcolor(W.LIGHTGREEN)
W.gotoxy(x, C.height - 1)
else:
match = None
#Read input
W.setcursortype(1)
(chn, chs) = W.getch()
W.setcursortype(0)
#figure out if we're done
if chs == '\r':
#enter, exit
break
if chn == 8:
#backspace
if len(buf):
buf.pop()
else:
MessageBeep()
continue
if chn == 3:
log.debug('took a ctrl-c')
game.fire('specialkey', 'ctrlc')
break
if chn == 0 or chn == 224:
#special keys come in two parts
(chn2, _) = W.getch()
if chn2 in W.__keydict:
game.fire('specialkey', W.__keydict[chn2])
continue
if len(buf) >= C.width:
#way too long now
break
if chs not in string.printable:
#dont care
continue
buf.append(chs)
return buf, match
示例7:
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)
import sys
import os
if 'nt' not in os.name:
import XConio
import curses
import game
game.start = curses.wrapper(game.start)
import WConio as W
defaultcolor = W.gettextinfo()[4]
import game
try:
game.start()
except game.GameShutdown:
W.textmode()
pass
except KeyboardInterrupt:
W.textmode()
raise
except:
raise
finally:
logger.debug("Shutting down")
logging.shutdown()
W.clreol()
W.textattr(defaultcolor)
W.setcursortype(1)
示例8: delete_line
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def delete_line(self):
if os.name != 'nt':
sys.stdout.write("\r" + Term.delete)
else:
WConio.clreol()
示例9: clearLines
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import clreol [as 别名]
def clearLines():
for i in range (21,24):
WConio.gotoxy(0,i)
WConio.clreol()