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


Python Tree.tree方法代码示例

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


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

示例1: background

# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import tree [as 别名]
def background():
    """Creates the general background scenery"""
    #Creates random clouds in the sky
    for r in range(0,cloudNum):
        #Initialize variables
        x = randint(-100,1200)
        y = randint(-20,100)
        width = randint(60,90)
        height = randint(20,50)
        cloudColor = choice(["gray92","gray95","gray98"])
        
        #Create lots of ovals to represent clouds
        for i in range(0,20):
            x1 = x - randint(1, width)
            y1 = y - randint(1, height)
            x2 = x + randint(1, width)
            y2 = y + randint(1, height)
            oval = screen.create_oval(x1, y1, x2, y2, fill=cloudColor, outline=cloudColor)
        
    #Ground behind the trees
    screen.create_oval(-100,320,1100,600, fill ="gainsboro", outline ="gainsboro")

    #Trees from Tree.py
    Tree.tree(screen)
    
    #Snowy Ground
    screen.create_rectangle (0,500,1000,800,fill="snow",outline="snow")
    screen.create_polygon (0,500,50,500,100,450,250,470,400,430,500,450,650,420,700,450,800,460,1020,470,1000,600, fill="snow",outline="snow",smooth="true")

    #Scorebox
    screen.create_rectangle( 320,100,680,350, fill="#80d5ff", outline="white", width="8")
开发者ID:Advait-M,项目名称:Snowball-Duel,代码行数:33,代码来源:Graphical+Game+App_1.py


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