当前位置: 首页>>代码示例>>Python>>正文


Python WConio.gotoxy方法代码示例

本文整理汇总了Python中WConio.gotoxy方法的典型用法代码示例。如果您正苦于以下问题:Python WConio.gotoxy方法的具体用法?Python WConio.gotoxy怎么用?Python WConio.gotoxy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WConio的用法示例。


在下文中一共展示了WConio.gotoxy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: selectDestination

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
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		
开发者ID:marcgalang,项目名称:otto,代码行数:28,代码来源:otto.py

示例2: main

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [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,
开发者ID:countrymarmot,项目名称:mccdaq,代码行数:28,代码来源:ULDI01.py

示例3: display_suggestion

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [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
开发者ID:jtruscott,项目名称:ld21,代码行数:28,代码来源:gameprompt.py

示例4: main

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
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
开发者ID:countrymarmot,项目名称:mccdaq,代码行数:31,代码来源:ULAO01.py

示例5: run

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
    def run ( self ):
        tt = DrawGUI()
	s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	host = ''
	port = 8888
	s.bind((host, port))
	s.listen(5)
	WConio.gotoxy(0,24)
	WConio.textcolor(WConio.YELLOW)
        print "Awaiting Connections"
	WConio.gotoxy(17,22)
	posy = 4
	count = 0
	while 1:
            conn, addr = s.accept()
            WConio.textcolor(WConio.YELLOW)
            c = 0
            for p in l:
                c = c + 1
                if addr[0] == p[1][0]:
                    cmd = enc('clean', key)
                    conn.send(cmd)
                else:
                    l.append([conn, addr])
            if c == 0:
                l.append([conn, addr])
开发者ID:r0ot,项目名称:ArxBot-old,代码行数:28,代码来源:control.py

示例6: writeout

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [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)
开发者ID:gneposis,项目名称:gntools_old,代码行数:27,代码来源:filepath.py

示例7: robust_write

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
 def robust_write(self, command = ''):
     """Write to the RCS with robust exception handling."""
     try:
         self.write(command)
     except DisconnectError:
         global servo_mode
         servo_mode = IDLE
         # Blank screen due to device disconnect.
         WConio.textattr(0xb0)
         WConio.clrscr()
         WConio.gotoxy(10, 10)
         WConio.cputs('USB-RCS has been disconnected during write. '
                      'Trying to reconnect. ')
         self.robust_reconnect()
         usb = rcs.robust_read('U')
         firmware_version = usb[2]
         display_once(firmware_version)
     except Exception, e:
         WConio.textattr(0xc0)
         WConio.clrscr()
         WConio.gotoxy(0, 10)
         print "Unexpected exception in robust_write: ", type(e)
         print
         print e
         print
         raw_input("Press enter to exit ->")
         exit()
开发者ID:philips,项目名称:feusb,代码行数:29,代码来源:TestRCS.py

示例8: put

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [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)
开发者ID:chyser,项目名称:bin,代码行数:10,代码来源:conio.py

示例9: status

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [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)
开发者ID:chyser,项目名称:bin,代码行数:11,代码来源:conio.py

示例10: put_at

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [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)
开发者ID:jtruscott,项目名称:ld21,代码行数:11,代码来源:draw.py

示例11: draw_box_text

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [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)
开发者ID:jtruscott,项目名称:ld21,代码行数:13,代码来源:draw.py

示例12: selectToken

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
def selectToken (gameArray,arrows,player):
	WConio.gotoxy(0,23)
	print "{0:^79}".format("Select one of your tokens to initiate a move.")
	k=None
	player=1
	while k<>"q":
		printCursor(gameArray,cursor)
		if k =="u":
			printUnicode()
		if k =="a":
			printAscii()
			
		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])%len(gameArray)
			cursor[1]=(cursor[1]+arrows[2][d])%len(gameArray[0])
		printCursor(gameArray,cursor)

		if k == " ":# when 'spacebar' entered
			if ord(gameArray[cursor[0]][cursor[1]])<>player:
				WConio.gotoxy(0,21)
				print "{0:^79}".format("Player {0}, you can only select a space that is already yours.".format(player))
			else:	
				clearLines()
				WConio.gotoxy(0,21)
				print "{0:^79}".format("Token selected.")
				#print " "*79
				gameArray = selectDestination(gameArray,cursor,player,arrows)
				break		
开发者ID:marcgalang,项目名称:otto,代码行数:34,代码来源:otto.py

示例13: display_bar

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
def display_bar(xcol, yrow, color, division, width):
    """Display a bar of 'color' and 'width', with two sections at 'division'."""
    full_cells, cell_frac = divmod(int(width * division * 3), 3)
    if division < 0:
        display_string = SPACE * width
    elif full_cells == width:
        display_string = FULL_BAR * width
    elif cell_frac == 0:
        display_string = FULL_BAR * full_cells + SPACE * (width - full_cells)
    elif cell_frac == 1:
        display_string = FULL_BAR * full_cells + HALF_BAR + SPACE * (width - full_cells - 1)
    else:
        display_string = FULL_BAR * (full_cells + 1) + SPACE * (width - full_cells - 1)
    WConio.gotoxy(xcol, yrow)
    WConio.textattr(color)
    WConio.cputs(display_string)
开发者ID:philips,项目名称:feusb,代码行数:18,代码来源:TestRCS.py

示例14: __draw

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
 def __draw(self):
    WConio.clrscr()
    
    # make walls
    for i in xrange(len(self.__walls)):
       self.__walls[i].draw()
       
    self.__worldInfo.player.draw((1,1))
    for z in self.__worldInfo.zombies:
       z.draw((1,1))
    for h in self.__worldInfo.healthPacks:
       h.draw((1,1))
    
    self.__drawHUD()
       
    WConio.gotoxy(0,self.__size[1] + 2)
开发者ID:elizabeth-matthews,项目名称:atlasChronicle,代码行数:18,代码来源:gameManager.py

示例15: robust_read

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import gotoxy [as 别名]
 def robust_read(self, command = None, count = 1):
     """Read from the RCS with robust exception handling."""
     global servo_mode
     while True:
         try:
             return self.read(command, count)
         except DisconnectError:
             servo_mode = IDLE
             # Blank screen due to device disconnect.
             WConio.textattr(0xb0)
             WConio.clrscr()
             WConio.gotoxy(10, 10)
             WConio.cputs('USB-RCS has been disconnected during read. '
                          'Trying to reconnect. ')
             self.robust_reconnect()
             usb = rcs.robust_read('U')
             firmware_version = usb[2]
             display_once(firmware_version)
         except ReadTimeoutError, e:
             servo_mode = IDLE
             # Blank screen due to device disconnect.
             WConio.textattr(0xc0)
             WConio.clrscr()
             WConio.gotoxy(10, 10)
             WConio.cputs('USB-RCS read timeout: '
                          'Communications is not responding as expected.')
             WConio.gotoxy(10, 12)
             raw_input("Unplug the USB-RCS.")
             while self.status() != DISCONNECTED:
                 time.sleep(0.500)
             WConio.gotoxy(10, 12)
             WConio.cputs("Now, plug-in the USB-RCS.")
             self.robust_reconnect()
             usb = rcs.robust_read('U')
             firmware_version = usb[2]
             display_once(firmware_version)
         except Exception, e:
             WConio.textattr(0xc0)
             WConio.clrscr()
             WConio.gotoxy(0, 10)
             print "Unexpected exception in robust_read: ", type(e)
             print e
             raw_input("Press enter to exit ->")
             exit()
开发者ID:philips,项目名称:feusb,代码行数:46,代码来源:TestRCS.py


注:本文中的WConio.gotoxy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。