本文整理汇总了Python中WConio.gettextinfo方法的典型用法代码示例。如果您正苦于以下问题:Python WConio.gettextinfo方法的具体用法?Python WConio.gettextinfo怎么用?Python WConio.gettextinfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WConio
的用法示例。
在下文中一共展示了WConio.gettextinfo方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def __init__(self):
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
object.__init__(self)
self.origCursor = 1
self.curCursor = 1
self.origState = wc.gettextinfo()[4] & 0x00FF
t = wc.gettextinfo()
self.sx = 0
self.sy = 0
self.ex = t[2]
self.ey = t[3]
self.wd = t[2]
self.ht = t[3]
示例2: log_color
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [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 )
示例3: writeout
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def writeout(s, o, c=True, replace_lines=0):
'''Writes out a string to the stdout or appends it to a file'''
if not o:
if c:
s = deutfize(s)
if replace_lines and sys.platform in WINDOWS:
try:
import WConio
pos = WConio.wherex(), WConio.wherey()
for i in range(replace_lines):
sys.stdout.write(' '*(WConio.gettextinfo()[-3]-1) + '\n')
WConio.gotoxy(pos[0], pos[1])
except:
replace_lines=0
sys.stdout.write(s)
if replace_lines and sys.platform in WINDOWS:
WConio.gotoxy(pos[0], pos[1])
else:
with open(o, mode='a', encoding='utf-8') as o_file:
o_file.write(s)
示例4: main
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def main():
USB1208LS=MCCDAQ()
WConio.clrscr()
print "Demonstration of cbDIn()\n"\
"Press any key to quit.\n\n"\
"You may change a bit by applying a TTL high or\n"\
"a TTL low to the corresponding pin# on port A.\n"
print "The first 7 bits are: pin32 to pin 39\n"\
"0 1 2 3 4 5 6 7\n "
(a,a,a,a,a,a,a,a,a,a,row)=WConio.gettextinfo()
USB1208LS.DConfigPort (0, FIRSTPORTB, DIGITALIN)
while (WConio.kbhit()==False):
DataValue=USB1208LS.DIn(0, FIRSTPORTB)
WConio.gotoxy(0,row)
print "Port Value: %d " %DataValue
# parse DataValue into bit values to indicate on/off status */
for I in range (8):
if (DataValue & 2**I): BitValue = 1
else: BitValue = 0
print "%d " %BitValue,
示例5: log_color
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def log_color( fg_color, text ):
"""
Store current attribute settings
"""
old_setting = WConio.gettextinfo()[4] & 0x00FF
WConio.textattr( COLOR_ID[ fg_color ] )
print text
WConio.textattr( old_setting )
示例6: _write_color_nt
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [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)
示例7: __init__
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def __init__(self, display_keys=True, display_header=True, outfile=sys.stdout):
self.display_keys = display_keys
self.display_header = display_header
self.interactive = False
self.print_lines = 0
self.termrows = 0
self.outfile = outfile
# XXX if stdin is not a tty, it seems that the command fails.
if os.isatty(sys.stdout.fileno()) and os.isatty(sys.stdin.fileno()):
if sys.platform == 'win32':
self.termrows = WConio.gettextinfo()[8]
else:
self.termrows = int(subprocess.Popen('stty size', shell=True, stdout=subprocess.PIPE).communicate()[0].split()[0])
示例8: menu
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def menu(options, deletepreviouslines=0):
_sel()
_otr() # Initialize terminal conditions
home = WConio.wherey() # Gets original y coordinate
startup = home - deletepreviouslines - 2
y = 0
draw(options, y)
multiple = []
escolha = ''
while escolha != '\r': #\r = enter
escolha = WConio.getkey()
if escolha == 'up':
if y != 0:
y-=1
if escolha == 'down':
if y != len(options)-1:
y+=1
if escolha == '+':
multiple.append(options[y])
if options[y][-1] != '+':
options[y] += '+'
# To do: add option to remove from list
WConio.gotoxy(0, home)
draw(options,y)
_otr()
for i in range(WConio.wherey(), startup, -1):
WConio.gotoxy(0, i)
sys.stdout.write(' '*WConio.gettextinfo()[8])
WConio.gotoxy(0, startup)
if len(multiple)>0:
return multiple
else:
return [options[y]]
示例9: emit
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def emit(self, record):
WConio = self.WConio
try:
msg = self.format(record)
levelname = record.levelname
out = sys.__stdout__ # in case redirected by filelogger, etc
if levelname in msg:
part1, part2 = msg.split(levelname, 1)
out.write(part1)
out.flush()
saved_color = WConio.gettextinfo()[4]
WConio.textattr( self.colormap.get(levelname,
WConio.LIGHTGREY) )
if levelname == 'CRITICAL': WConio.textbackground(WConio.RED)
WConio.cputs(levelname)
WConio.textattr(saved_color) # restore
print >> out, part2
else:
print >> out, msg
out.flush()
except:
self.handleError(record)
示例10: main
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def main():
USB1208LS=MCCDAQ()
WConio.clrscr()
print "Demonstration of AIn()\n"\
"Press any key to quit.\n"
# get the A/D channel to sample
Chan = int ( raw_input('Enter the channel to display: ') )
print "\nThe raw data value on Channel %u is: " %Chan,
(a,a,a,a,a,a,a,a,a,col,row)=WConio.gettextinfo()
print "\nThe voltage on Channel %u is: " %Chan,
# collect the sample from the channel until a key is pressed
while (WConio.kbhit()==False):
DataValue=USB1208LS.AIn (0, Chan, BIP5VOLTS)
EngUnits =USB1208LS.ToEngUnits (0, BIP5VOLTS, DataValue)
WConio.gotoxy(col,row)
print "%5d" %DataValue,
WConio.gotoxy(col,row+1)
print "%.2fV" %EngUnits,
示例11: GetConnections
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
import sys
import socket
import string
import os
import io
import time
import random
import urllib2
import re
import WConio
import threading
import sys
#(2,24)
old_setting = WConio.gettextinfo()[4] & 0x00FF
WConio.clrscr()
WConio.settitle("PyBot Control Center")
WConio.gotoxy(2,2)
WConio.cputs("Welcome to the PyBot Control Center\n\r")
f = open('C:\\PyBot\\connections.txt', 'w')
j = open('C:\\PyBot\\update.txt', 'w')
p = open('C:\\PyBot\\cmd.txt', 'w')
f.write('')
j.write('')
p.write('')
f.close()
j.close()
class GetConnections ( threading.Thread ):
def run ( self ):
WConio.textcolor(WConio.LIGHTRED)
示例12:
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
hdlr = logging.FileHandler('debug.log')
formatter = logging.Formatter('%(asctime)s %(name)s:%(levelname)s %(message)s')
hdlr.setFormatter(formatter)
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()
示例13: getCursorPos
# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gettextinfo [as 别名]
def getCursorPos():
#-------------------------------------------------------------------------------
t = wc.gettextinfo()
return t[9], t[10]