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


Python WConio.setcursortype方法代码示例

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


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

示例1: cursor

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import setcursortype [as 别名]
 def cursor(self, val):
 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     old = self.curCursor
     if val is None: val = self.origCursor
     self.curCursor = val
     wc.setcursortype(val)
     return old
开发者ID:chyser,项目名称:bin,代码行数:9,代码来源:conio.py

示例2: restore

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import setcursortype [as 别名]
def restore():
    '''
        Keep the terminal usable.
        Always performed on exit.
    '''
    W.clreol()
    W.textattr(defaultcolor)
    W.setcursortype(1)
开发者ID:jtruscott,项目名称:pyweek13,代码行数:10,代码来源:term_win.py

示例3: __init__

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import setcursortype [as 别名]
 def __init__(self):
    
    random.seed()
    WConio.setcursortype(0)  # 0 no cursor, 1 normal, 2 block
    self.__size = (20,20)
    
    self.__zombieSpawner = Spawner((9,14))
    self.__healthSpawner = Spawner((10,16))
    
    self.__maxZombies = 10
    self.__maxHealthPacks = 10
    
    self.__RUN = True
    self.__wallColor = WConio.LIGHTGRAY
    self.__HUDColor = WConio.WHITE
    
    self.__wallCharacter = "#"
    
    startX = 1
    startY = 1
    
    self.__worldInfo = WorldInfo(*self.__size)
    self.__worldInfo.player = Player(startX, startY)
    
    self.__kills = 0
    self.__turns = 0
    
    
    self.__walls = []
    
    for x in xrange(self.__size[0]+2):
       self.__walls.append(Drawable(x,0,self.__wallCharacter,self.__wallColor))
       self.__walls.append(Drawable(x,self.__size[1]+1, self.__wallCharacter,self.__wallColor))
    
    for y in xrange(1,self.__size[1]+1):
       self.__walls.append(Drawable(0,y,self.__wallCharacter,self.__wallColor))
       self.__walls.append(Drawable(self.__size[0]+1,y,self.__wallCharacter,self.__wallColor))
开发者ID:elizabeth-matthews,项目名称:atlasChronicle,代码行数:39,代码来源:gameManager.py

示例4: get_input

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

示例5:

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

示例6: __init__

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import setcursortype [as 别名]
    def __init__(self):
        self.config = Config()
       
        if not os.path.exists(self.config['steampath']):
            raise SystemExit('steam.exe not found. Did you check your preferences?\n')

        if '-login' in sys.argv:
            import subprocess as sp

            username = sys.argv[-1]
            try:
                password = self.config['accounts'][sys.argv[-1]]['password']
            except KeyError:
                print "\nNo login information for that account found. Did you type your username in"
                print "correctly? You might be typing in the SteamCommunity name, but we need the"
                print "actual login name for the account."
                sys.exit(0)
            
            if idle.isrunning('hl2.exe'):
               idle.kill('hl2.exe')
            if idle.isrunning('steam.exe'):
               idle.kill('steam.exe')        #kills Steam and TF2 wether they're running or not

            launchargs = self.config['steampath'] + ' -login {0} {1}'.format(username, password)
            print 'Launching account %s...' % username
            sp.Popen(launchargs)

        elif '-start' in sys.argv:
            import subprocess as sp

            if not idle.isrunning('steam.exe'):
                raise SystemExit("Steam is not running. Please run this without arguments to select an account.")

            launchargs = self.config['steampath']+' -applaunch 440 -console -textmode -novid -nosound -noipx -nopreload -nojoy -noshader +map_background ctf_2fort'
            print 'Launching idler'
            sp.Popen(launchargs)

        elif '-continue' in sys.argv:
            idle.continueidling(self.config)

        elif '-infinite' in sys.argv: #very rough implementation
            print len(self.config['accounts']), 'account(s) identified.\n'
            
            while True:
                for username in sorted(list(self.config['accounts'].iterkeys())):
                    idle.idle(username)

        else: #no valid arguments
            WConio.setcursortype(0)
            print len(self.config['accounts']), 'account(s) identified.\n'

            usernames = menu( ['Idle with all accounts'] + sorted(list(self.config['accounts'].iterkeys())) + ['Exit'] )

            if usernames == ['Idle with all accounts']:
                for username in [name for name in self.config['accounts'].iterkeys()]:
                    idle.idle(username)

                print 'Finished idling for all accounts!'
            elif (usernames == 'Exit') or ('Exit' in usernames):
                pass
            else:
                for name in usernames:
                    idle.idle(name)
            
            WConio.setcursortype(1)
开发者ID:roddds,项目名称:idler,代码行数:67,代码来源:idler.py

示例7: type

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import setcursortype [as 别名]
            except Exception, e:
                WConio.gotoxy(5, 16)
                print "Unexpected exception during reconnect:", type(e)
                print e
                raw_input("Press enter to exit ->")
                exit()
            else:
                return

########## Main Routine ##########
if __name__=='__main__':
    try:
        WConio.settitle("TestRCS -- Test the RC Servo Controller")
        # Initial Page, Select and Open the Serial Port
        WConio.textattr(0x07)
        WConio.setcursortype(2)
        rcs = get_rcs()   # select a port and open the rcs
        WConio.setcursortype(0)
        WConio.cputs("\nCommunications port is open!\n")
        time.sleep(0.5)
        # disable servos, configure analog, read:  USB report, servo status, analog
        usb, all_servos, analog_channels  = rcs.robust_read('CA0USM', 3)
        firmware_version = usb[2]
        disabled = (all_servos[-1][-1] == -1)

        # Servo and Analog Display Page
        servo_mode = IDLE   # Set up variables for running servos
        command_mode = INIT
        accel_dif = False
        accel_list = [1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 255]
        display_once(firmware_version)      # Display static and initial items
开发者ID:philips,项目名称:feusb,代码行数:33,代码来源:TestRCS.py

示例8: len

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import setcursortype [as 别名]
        count = True
        sys.argv.remove('-count')
    else:
        count = False

    if '-all' in sys.argv:
        config = idler.Config()
        accounts = [config['accounts'][steamid]['steamcommunity'] for steamid in config['accounts']]
        sys.argv.remove('-all')
    else:
        accounts = sys.argv[1:]
        if len(accounts) <= 0:
            raise SystemExit("We need some accounts here, bro.")

    if '-watch' in sys.argv:
        WConio.setcursortype(0)
        accounts.remove('-watch')
        #bps         = [[username, Backpack(username)] for username in accounts]
        balloon     = toaster()
        now         = datetime.datetime.now
        lastdrop    = now()
        
        bps = {}

        for username in accounts:
            bps[username] = {'backpack':Backpack(username),
                                   'founditems': []}
            try: # check if there are any still unplaced items
                bps[username]['founditems'] = bps[username]['backpack'].inventory(getunplaced=True)
            except ValueError:
                print "%s's unavailable at startup. This may be temporary."
开发者ID:roddds,项目名称:idler,代码行数:33,代码来源:inv.py

示例9: setcursortype

# 需要导入模块: import WConio [as 别名]
# 或者: from WConio import setcursortype [as 别名]
def setcursortype(i):
    W.setcursortype(i)
开发者ID:jtruscott,项目名称:pyweek13,代码行数:4,代码来源:term_win.py


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