本文整理汇总了Python中WConio.textcolor方法的典型用法代码示例。如果您正苦于以下问题:Python WConio.textcolor方法的具体用法?Python WConio.textcolor怎么用?Python WConio.textcolor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WConio
的用法示例。
在下文中一共展示了WConio.textcolor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def run(self):
global connections
global services
if ready == 0:
time.sleep(0.5)
elif ready == 1:
time.sleep(1)
print("\nTMain ["+time.strftime("%H:%M:%S")+"] == ready, waiting for connections...\n")
while 1:
try:
s.listen(1)
conns, addr = s.accept()
data = conns.recv(1024)
print("TMain ["+time.strftime("%H:%M:%S")+"] << Connected by "+addr[0]+"\n")
connections = connections + 1
job = conns, data,addr[0]
jobs.enqueue(job)
print("TMain ["+time.strftime("%H:%M:%S")+"] == Job pushed to Queue\n")
except:
WConio.textcolor(4)
print("TMain ["+time.strftime("%H:%M:%S")+"] !! Error while running. Will restart now!\n")
WConio.textcolor(2)
示例2: run
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def run ( self ):
WConio.textcolor(WConio.LIGHTBLUE)
while 1:
t = open('C:\\PyBot\\cmd.txt', 'r')
cmd = t.read()
t.close()
if cmd == '':
time.sleep(3)
continue
else:
#self.Test()
if cmd == 'test':
l = open('C:\\PyBot\\update.txt', 'r')
str = l.read().split("\n")
for i in str:
if i != '':
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((i, 8888))
s.send('test')
s.close()
#else:
#if cmd == 'exit':
#time.sleep(3)
#WConio.clrscr()
#WConio.gotoxy(0,0)
#raise SystemExit
#os._exit()
#sys.exit()
time.sleep(3)
示例3: display_suggestion
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [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
示例4: log_color
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def log_color ( self, message, record ):
""" Testing """
if record.levelno in self.LEVEL_ID:
old_setting = WConio.gettextinfo()[4] & 0x00FF
WConio.textcolor( self.LEVEL_ID[record.levelno] )
return message
WConio.textcolor( old_setting )
示例5: set_colour
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def set_colour(self, colour):
cc, wc = colour
if os.name != 'nt':
sys.stdout.write(cc)
else:
WConio.textcolor(wc)
示例6: set_color
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def set_color( self, color ):
'''Check the platform and set the color'''
if self.platform == 'posix':
sys.stdout.write( self.color_syntax + self.color[color] )
sys.stderr.write( self.color_syntax + self.color[color] )
elif self.platform == 'microsoft':
WConio.textcolor( self.color[color] )
示例7: run
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def run ( self ):
time.sleep(3)
oldLen = 0
while 1:
newLen = len(l)
WConio.textcolor(WConio.LIGHTCYAN)
posX = WConio.wherex()
posY = WConio.wherey()
WConio.gotoxy(0,4)
if newLen < oldLen:
for n in range(oldLen+1):
WConio.cputs(" \n\r")
else:
for n in range(len(l)+1):
WConio.cputs(" \n\r")
WConio.gotoxy(0,4)
for i in range(len(l)):
try:
print str(i) + ': ' + str(l[i][2])
except:
print str(i) + ': ' + str(l[i][1][0])
if posX > 16:
WConio.gotoxy(posX,22)
else:
WConio.gotoxy(17,22)
oldLen = len(l)
time.sleep(3)
示例8: put
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def put(x, y, s, fgc=None, bgc=None):
#-------------------------------------------------------------------------------
wc.gotoxy(x, y)
if bgc:
wc.textbackground(bgc)
if fgc:
wc.textcolor(fgc)
wc.cputs(s)
示例9: put_at
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def put_at(x, y, msg, color=None):
if color:
W.textcolor(color)
if len(msg) + x > C.width:
log.debug('put_at: truncating %s by %i', msg, len(msg) + x - C.width)
msg = msg[:C.width - x - 1]
W.gotoxy(x, y)
W.cputs(msg)
示例10: write
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def write(self, string, colour):
cc, wc = colour
if os.name != 'nt':
sys.stdout.write(cc + string + Term.reset)
else:
WConio.textcolor(wc)
sys.stdout.write(string)
WConio.textcolor(8)
示例11: _write_color_nt
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def _write_color_nt(fp, text, color):
"""Assumes WConio has been imported at module level."""
oldcolor = WConio.gettextinfo()[4]
oldtextcolor = oldcolor & 0x000F
if ";" in color:
color = color.split(";", 1)[1]
WConio.textcolor(WConioColor.get(color, oldtextcolor))
fp.write(text)
WConio.textattr(oldcolor)
示例12: status
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [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)
示例13: draw_box_text
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def draw_box_text(box, text=None):
if text is None:
text = box.text
W.textbackground(box.interior_background_color)
for line in text:
W.textcolor(line.color)
if line.right_justify:
W.gotoxy(box.left + box.width - line.x - len(line.text), box.top + line.y)
else:
W.gotoxy(box.left + line.x, box.top + line.y)
W.cputs(line.text)
示例14: download
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def download(url):
webFile = urllib.urlopen(url)
filename = url.split('/')[-1]
localFile = open(filename, 'w')
print '\n Downloading File:',filename,'...',
localFile.write(webFile.read())
webFile.close()
localFile.close()
WConio.textcolor(2)
print 'done'
WConio.textcolor(7)
示例15: _write
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import textcolor [as 别名]
def _write(self, text, line_suffix, color = ("", 8)):
cc, wc = color
if cc != "":
if self.OS != 'nt':
sys.stdout.write(cc)
else:
WConio.textcolor(wc)
self._write_line(text, line_suffix)
if wc != "":
if self.OS!='nt':
sys.stdout.write("\033[0;0m")
else:
WConio.textcolor(8)