本文整理汇总了Python中WConio类的典型用法代码示例。如果您正苦于以下问题:Python WConio类的具体用法?Python WConio怎么用?Python WConio使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WConio类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeArray
def makeArray(size):
WConio.clrscr()
gameArray=None
gameArray=[[chr(250) for y in range(size[1])] for x in range(size[0])]
printGrid(gameArray)
printBoard(gameArray)
return gameArray
示例2: set_color
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] )
示例3: play
def play(self):
repeats = 0
lastclick = None
while True:
#self.find_diamond()
items = self.find_one()
if items:
self.click(items)
#print "clicked", items
if items == lastclick:
repeats += 1
else:
lastclick = items
#time.sleep(0.1)
#os.system('cls')
WConio.clrscr()
print '\n'.join([' '.join(x) for x in self.get_matrix()])
# else:
# #time.sleep(0.5)
# self.click(self.buffer[0])
# print "Clicked from buffer", self.buffer[0]
# self.buffer.remove(self.buffer[0])
# time.sleep(0.1)
# #print "Waiting..."
# # fails += 1
if repeats >= 5:
return "Finished!"
示例4: main
def main():
USB1208LS=MCCDAQ()
USB1208LS.FlashLED(0)
USB1208LS.GetBoardName(0)
i=USB1208LS.getStatus()
print USB1208LS.GetErrMsg(i)
print USB1208LS.GetConfig(BOARDINFO,0,0,BISERIALNUM)
WConio.clrscr()
print "Demonstration of cbAOut() - chan0 pin13 - D/A 10bits"
ExitFlag = False
while (ExitFlag==False):
WConio.gotoxy (0, 3)
EngUnits = float ( raw_input('Enter a voltage between -5.0 and +5.0: ') )
DataValue=USB1208LS.FromEngUnits(0, BIP5VOLTS, EngUnits)
USB1208LS.AOut (0, 0 , BIP5VOLTS, DataValue)
print "%.2f volts has been sent to D/A 0.\n"\
"Press Q to quit , any other key to continue: " %EngUnits
(ch,)=WConio.getch()
if (ch=='q' or ch=='Q'): ExitFlag=True
示例5: run
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)
示例6: log_color
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 )
示例7: run
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)
示例8: get_rcs
def get_rcs():
"""Connect to the RCS on a user selected port."""
while True:
WConio.cputs('Available Ports\nSEL Comm Port\n--- ---------\n')
ports = ['Quit'] + port_list()
for i, v in enumerate(ports):
WConio.cputs('%3d %s\n'%(i, v))
sel_str = raw_input('Select a comm port or 0 to Quit -->')
try:
sel = int(sel_str)
ports[sel]
except Exception:
WConio.cputs('\nAcceptable values are 0 to %d.\n'%i)
else:
if sel == 0:
exit()
elif sel > 0:
try:
rcs = Robust_Feusb(ports[sel])
except OpenError, e:
WConio.cputs(str(e)+'\n')
else:
return rcs
else:
WConio.cputs('\nAcceptable values are 0 to %d.\n'%i)
示例9: ClearScreen
def ClearScreen():
# Clears the screen and moves the cursor to the upper left corner
if gOS == "Windows":
WConio.clrscr()
elif gOS == "Linux":
gConsole.erase()
gConsole.move(0, 0)
示例10: main
def main():
WConio.clrscr()
print "Demonstration of GetConfig().\n"\
"List of Installed Boards:\n"
# Get the number of boards installed in system
NumBoards=USB1208LS.GetConfig (GLOBALINFO, 0, 0, GINUMBOARDS)
USB1208LS.SetConfig (BOARDINFO, 0, 0, BINUMADCHANS,8) # single ended
#USB1208LS.SetConfig (BOARDINFO, 0, 0, BINUMADCHANS,4) # diff ended
for i in range(NumBoards):
# Get board type of each board
BoardType=USB1208LS.GetConfig (BOARDINFO, i, 0, BIBOARDTYPE)
# If a board is installed
if (BoardType > 0):
# Get the board's name
BoardNameStr=USB1208LS.GetBoardName (i)
print " Board #%d = %s" %(i,BoardNameStr)
# Get the board's base address
BaseAdr=USB1208LS.GetConfig (BOARDINFO, i, 0, BIBASEADR)
print " Base Address = 0x%x" %BaseAdr
PrintADInfo (i)
PrintDAInfo (i)
PrintDigInfo (i)
PrintCtrInfo (i)
PrintExpInfo (i)
raw_input("\npause")
示例11: _erase
def _erase(self):
self.written_x = 0
sys.stdout.write ("\r")
if self.OS != 'nt':
sys.stdout.write ("\x1b[0K")
else:
WConio.clreol()
示例12: selectDestination
def selectDestination(gameArray,cursor,player,arrows):
k=None
oldCursor = cursor[:]
while k<>"q":
k = WConio.getkey()
if k in arrows[0]:
#WConio.gotoxy(cursor[0]*2+1+40-len(gameArray),cursor[1]*2+1)
printGrid(gameArray) #'erase' cursor icon
d=arrows[0].index(k)
cursor[0]=(cursor[0]+arrows[1][d])
if cursor[0]<0 or cursor[0]>len(gameArray) or abs(cursor[0]-oldCursor[0])>2:
cursor[0]=(cursor[0]-arrows[1][d])
cursor[1]=(cursor[1]+arrows[2][d])
if cursor[1]<0 or cursor[1]>len(gameArray[0]) or abs(cursor[1]-oldCursor[1])>2:
cursor[1]=(cursor[1]-arrows[2][d])
printCursor(gameArray,oldCursor)
printCursor2(gameArray,cursor)
if k == " ":# when 'spacebar' entered
if ord(gameArray[cursor[0]][cursor[1]])<>250:
WConio.gotoxy(0,21)
print "{0:^79}".format("Player {0}, you can only move to empty spaces".format(player))
else:
finalizeMove(gameArray,oldCursor,cursor,player)
break
return gameArray
示例13: set_colour
def set_colour(self, colour):
cc, wc = colour
if os.name != 'nt':
sys.stdout.write(cc)
else:
WConio.textcolor(wc)
示例14: log_color
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 )
示例15: write
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)