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


Python Widget.bg_color方法代码示例

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


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

示例1: updateFilters

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import bg_color [as 别名]
 def updateFilters(self):
     totalFilters = 0
     updatedFilters = 0
     filtersDir = directories.getFiltersDir()
     try:
         os.mkdir(os.path.join(filtersDir, "updates"))
     except OSError:
         pass
     for module in self.filterModules.values():
         totalFilters += 1
         if hasattr(module, "UPDATE_URL") and hasattr(module, "VERSION"):
             if isinstance(module.UPDATE_URL, (str, unicode)) and isinstance(module.VERSION, (str, unicode)):
                 versionJSON = json.loads(urllib2.urlopen(module.UPDATE_URL).read())
                 if module.VERSION != versionJSON["Version"]:
                     urllib.urlretrieve(versionJSON["Download-URL"],
                                        os.path.join(filtersDir, "updates", versionJSON["Name"]))
                     updatedFilters += 1
     for f in os.listdir(os.path.join(filtersDir, "updates")):
         shutil.copy(os.path.join(filtersDir, "updates", f), filtersDir)
     shutil.rmtree(os.path.join(filtersDir, "updates"))
     finishedUpdatingWidget = Widget()
     lbl = Label("Updated %s filter(s) out of %s" % (updatedFilters, totalFilters))
     closeBTN = Button("Close this message", action=finishedUpdatingWidget.dismiss)
     col = Column((lbl, closeBTN))
     finishedUpdatingWidget.bg_color = (0.0, 0.0, 0.6)
     finishedUpdatingWidget.add(col)
     finishedUpdatingWidget.shrink_wrap()
     finishedUpdatingWidget.present()
开发者ID:gwpantazes,项目名称:MCEdit-Unified,代码行数:30,代码来源:filter.py

示例2: perform

# 需要导入模块: from albow import Widget [as 别名]
# 或者: from albow.Widget import bg_color [as 别名]
def perform(level, box, options):
    op = options["Operation"]
    #print dir(level.scoreboard.Objectives)
    #print level.init_scoreboard().PlayerScores["Chevalerie94"]
    print "Test Filter Ran"
    if op == "Yes/No Dialog":
        choice = editor.YesNoWidget("Place a sponge block here?")
        if choice:
            yesFunc(level, box)
            raise Exception("Response was Yes")
        else:
            raise Exception("Response was No")
    elif op == "Custom Dialog (Hi Button)":
        widget = Widget()
        widget.bg_color = (0.0, 0.0, 0.6)
        lbl = Label("Test Message from a External Widget")
        btn = Button("Hi", action=hiAction)
        widget.add(lbl)
        widget.add(btn)
        widget.shrink_wrap()
        editor.addExternalWidget(widget)        
    elif op == "Scoreboard Editing (Objective)":
        scoreboard = level.init_scoreboard()
        test_objective = TAG_Compound()
        test_objective["Name"] = TAG_String("FilterObjective")
        test_objective["DisplayName"] = TAG_String("FilterObjective")
        test_objective["CriteriaName"] = TAG_String("dummy")
        test_objective["RenderType"] = TAG_String("integer")
        scoreboard["data"]["Objectives"].append(test_objective)
        level.save_scoreboard(scorebaord)
        for objective in score.Objectives:
            print "Objective Name: " + str(objective["Name"].value)
    elif op == "Scoreboard Editing (Team)":
        if level.scoreboard != None:
            for team in level.scoreboard.Teams:
                print "Team Name: " + str(team.DisplayName)
    elif op == "Player Data":
        players = level.init_player_data()
        for p in players:
            print p.name
            for item in p.inventory:
                print item["id"].value
                print "==="
            p.save()
开发者ID:freundTech,项目名称:MCEdit-Unified,代码行数:46,代码来源:Test.py


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