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


Python Output.printToWindow方法代码示例

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


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

示例1: getChoiceFromList

# 需要导入模块: import Output [as 别名]
# 或者: from Output import printToWindow [as 别名]
def getChoiceFromList(player, prompt, list, noChoices=1):
    Output.menuWindow.clear()
    Output.printToWindow(prompt + '\n', Output.menuWindow)

    invalidActions = player._determineValidOptions(list)
    freeActions = player._determineFreeOptions(list)

    count = 1
    indexMapping = {}
    for i, currOption in enumerate(list):
        if currOption in invalidActions.keys():
            Output.printToWindow('{0:2d} - {1} - {2}\n'.format(count, currOption, invalidActions.get(currOption)), Output.menuWindow, colorPair=1)
        elif currOption in freeActions.keys():
            Output.printToWindow('{0:2d} - {1} - {2}\n'.format(count, currOption, freeActions.get(currOption)), Output.menuWindow, colorPair=2)
            indexMapping[count] = currOption
        else:
            Output.printToWindow('{0:2d} - {1}\n'.format(count, currOption), Output.menuWindow)
            indexMapping[count] = currOption
        count += 1
    chosenOption = []
    while True:
        for i in range(0, noChoices):
            Output.printToWindow('%d of %d : '%(i, noChoices), Output.menuWindow)
            choice = int(Output.menuWindow.getstr(2))
            #choice -= 48
            if choice >= 1 and choice <= len(list):
                if choice in indexMapping:
                    if noChoices > 1:
                        chosenOption.append(indexMapping[int(choice)])
                    else:
                        chosenOption = indexMapping[int(choice)]
        if len(chosenOption) > 0:
            return chosenOption
开发者ID:pmwheatley,项目名称:HollywoodStudios,代码行数:35,代码来源:Players.py

示例2: getChoiceFromStack

# 需要导入模块: import Output [as 别名]
# 或者: from Output import printToWindow [as 别名]
def getChoiceFromStack(prompt, currStack, noChoices=1):
    Output.menuWindow.clear()
    Output.printToWindow(prompt + '\n', Output.menuWindow)

    count = 1
    indexMapping = {}
    for i, currCard in enumerate(currStack.cards):
        Output.printToWindow('{0:2d} - {1}\n'.format(count, currCard.visibleName()), Output.menuWindow)
        indexMapping[count] = currCard.name
        count += 1
    chosenCard = []

    while True:
        for i in range(0, noChoices):
            Output.printToWindow('%d of %d : '%(i, noChoices), Output.menuWindow)
            choice = int(Output.menuWindow.getstr(2))
            #choice -= 48
            if choice >= 1 and choice <= len(currStack.cards):
                if choice in indexMapping:
                    chosenCard.append(indexMapping[choice])
        if len(chosenCard) > 0:
            return chosenCard
开发者ID:pmwheatley,项目名称:HollywoodStudios,代码行数:24,代码来源:Players.py


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