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


Python turtle.bgcolor函数代码示例

本文整理汇总了Python中turtle.bgcolor函数的典型用法代码示例。如果您正苦于以下问题:Python bgcolor函数的具体用法?Python bgcolor怎么用?Python bgcolor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: main

def main():
    '''
    Main loop which sets the parameters and calls the simulation
    '''  
    
    # Set the mood
    t.bgcolor('black')
    
    # Assumed scale: 100 pixels = 1AU.
    AU = 149.6e9                # 149.6 billion meters is one astronomical unit
    SCALE = 250 / AU                            # 2e-9;  100 px
    
    # Declare initial positions and velocities for two bodies
    sun_loc = np.array([0,0])
    sun_vel = np.array([0,0])
    
    earth_loc = np.array([-0.9*AU, 0])
    earth_vel = np.array([0, 35000])              # shows elliptical
    
    #mars_loc = np.array([(-227.9e9/146.6e9)*AU,0])
    #mars_vel = np.array([0,24070])
    
    # Create body objects
    sun = Body('Sun', 2e30, 'yellow', sun_loc, sun_vel, True)
    earth = Body('Earth', 5.9742e24, 'blue', earth_loc, earth_vel, False)
    #mars = Body('Mars', 6.39e23, 'red', mars_loc, mars_vel)
    
    # Do the actual work
    time, pos_data = solve_system([sun, earth], SCALE, AU)
    animate(time, pos_data)
开发者ID:emcangi,项目名称:Nbody,代码行数:30,代码来源:2+body+sim+RK+-+odeint.py

示例2: drawBoard

def drawBoard(b):
    #set up window
    t.setup(600,600)
    t.bgcolor("dark green")
    
    #turtle settings
    t.hideturtle()
    t.speed(0)
    
    num=len(b)
    side=600/num
    xcod=-300
    ycod=-300
    for x in b:
        for y in x:
            if(y> 0):
                drawsquare(xcod,ycod,side,'black')
            if(y< 0):
                drawsquare(xcod,ycod,side,'white')
            if(y==0):
                drawsquare(xcod,ycod,side,'dark green')
            
            xcod=xcod+side
        xcod=-300
        ycod=ycod+side
开发者ID:gK996,项目名称:Othello,代码行数:25,代码来源:project2.py

示例3: main

def main():
    '''
    Main loop which sets the parameters and calls the simulation
    '''  
    
    # Set the mood
    t.bgcolor('black')
    
    # Assumed scale: 100 pixels = 1AU.
    AU = 149.6e9                # 149.6 billion meters is one astronomical unit
    SCALE = 250 / AU                            # 2e-9;  100 px
    
    # Declare positions and velocities for two bodies
    sun_loc = np.array([0,0])
    sun_vel = np.array([0,0])
    
    earth_loc = np.array([-1*AU, 0])
    earth_vel = np.array([0, 35000])              # shows elliptical
    
    #mars_loc = np.array([(-227.9e9/146.6e9)*AU,0])
    #mars_vel = np.array([0,24070])
    
    sun = Body('Sun', 2e30, 'yellow', sun_loc, sun_vel)
    earth = Body('Earth', 5.9742e24, 'blue', earth_loc, earth_vel)
    #mars = Body('Mars', 6.39e23, 'red', mars_loc, mars_vel)
    
    run([sun, earth], SCALE, AU)
开发者ID:emcangi,项目名称:Nbody,代码行数:27,代码来源:simulator+2D.py

示例4: franklinBegin

def franklinBegin():
		turtle.screensize(3000, 3000)
		turtle.clearscreen()
		turtle.bgcolor('black')
		franklin = turtle.Turtle(visible = False)
		franklin.color('green', 'green')
		franklin.speed(0)
		return franklin
开发者ID:pbialas,项目名称:lsystem,代码行数:8,代码来源:franklinFraktal.py

示例5: init_screen

def init_screen():
    # Delete the turtle's drawings from the screen, re-center the turtle and
    # set variables to the default values
    screen = turtle.Screen()
    screen.setup(width=500, height=500)
    screen.title('Yin Yang')
    turtle.reset()
    turtle.bgcolor('#E8E8F6')
    turtle.hideturtle()
开发者ID:mwoinoski,项目名称:crs1906,代码行数:9,代码来源:yinyang_multi_four_threads.py

示例6: __init__

 def __init__(self, demo, levels):
     turtle.bgcolor('black')
     fun = getattr(self,'demo_'+demo)
     koopa, path = fun(levels) if levels else fun()
     koopa.width(2)
     koopa.color('white')
     koopa.speed(8)
     koopa.draw(path)
     raw_input()
开发者ID:kvalle,项目名称:lindenmayer,代码行数:9,代码来源:demo.py

示例7: ready

def ready(rad):
    turtle.speed(0)
    turtle.ht()
    turtle.up()
    turtle.goto(0,-rad)
    turtle.down()
    turtle.colormode(1)
    turtle.bgcolor('black')
    turtle.pensize(1.1)
开发者ID:hehe3301,项目名称:Recursion_Training,代码行数:9,代码来源:recCircle.py

示例8: test_bgcolor

    def test_bgcolor(self):
        for c in (spanish_colors):
            tortuga.color_fondo(c)
            tortuga.forward(3)

        for c in (english_colors):
            turtle.bgcolor(c)
            turtle.forward(3)

        self.assert_same()
开发者ID:asweigart,项目名称:tortuga,代码行数:10,代码来源:turtleTest.py

示例9: __init__

    def  __init__(self,radius=500,mass=15000,name="star",colour="yellow"):
        super().__init__(radius,mass)
        self.turt=turtle.Turtle()
        self.radius=radius
        self.mass=mass
        self.name=name
        self.colour=colour

        turtle.bgcolor('black') #bg color
        self.turt.shape("circle")
        self.turt.shapesize(self.radius,self.radius,1)
        self.turt.color(self.colour)
开发者ID:mcgettin,项目名称:ditOldProgramming,代码行数:12,代码来源:starObj.py

示例10: screen_setup

def screen_setup():
    turtle.setup(900, 500, 0,0)
    turtle.title("Navigation system")
    turtle.bgcolor('black')
    con = turtle.Turtle()
    con.penup()
    con.speed(0)
    con.color('white')
    con.hideturtle()
    con.setpos(420, -230)
    con.write('+')
    con.setpos(430, -230)
    con.write('-')
开发者ID:johnkershaw,项目名称:bryn_game,代码行数:13,代码来源:docking.py

示例11: tegn_bakgrunn

def tegn_bakgrunn():
    turtle.bgcolor('black')
    turtle.speed(11)
    turtle.pensize(10)
    turtle.penup()
    turtle.setposition(-400, -300)
    turtle.pendown()
    turtle.color('grey')
    turtle.forward(200)
    turtle.color('red')
    turtle.forward(200)
    turtle.color('grey')
    turtle.forward(400)
开发者ID:gahjelle,项目名称:gahjelle.github.io,代码行数:13,代码来源:rosetta_og_philae.py

示例12: main

def main():
	myTurtle = turtle.Turtle()
	screen = turtle.Screen()
	turtle.bgcolor("lightblue")
	myTurtle.color("white")
	myTurtle.width(10)
	
	for i in range(0,360,30):
		drawStrand(myTurtle,100)
		myTurtle.left(30)
		
	myTurtle.hideturtle()
	screen.exitonclick()	
开发者ID:LindaPulickal,项目名称:Turtle-Art,代码行数:13,代码来源:snowflake.py

示例13: background_color

    def background_color(self, quadruple):
        operand1_dir = int(quadruple['operand_1'])
        operand2_dir = int(quadruple['operand_2'])
        operand3_dir = int(quadruple['result'])

        operand1 = self.memory_map.get_value(operand1_dir)
        operand2 = self.memory_map.get_value(operand2_dir)
        operand3 = self.memory_map.get_value(operand3_dir)

        self.log.write(" ****************** Quadruple " + str(self.current_quadruple) + " **********************")
        self.log.write(" * background_color: " + str(operand1) + ' ' + str(operand1) + ' ' + str(operand3))
        turtle.colormode(255)
        turtle.bgcolor(operand1, operand2, operand3)
开发者ID:maumruiz,项目名称:Tortuga,代码行数:13,代码来源:virtual_machine.py

示例14: main

def main():
    '''
    Sets the parameters and calls the functions which solve the system and then
    animate it. Planet and sun sizes are not to scale.
    '''

    from math import sqrt

    # Set the mood
    t.bgcolor('black')

    # planet selector. 0 = Mercury, 1 = Venus, ... 7 = Neptune
    planet = 7

    # Initial parameters. a = semimajor axis in AU; e = eccentricity;
    # mass = mass in kg. given in arrays where first item is Mercury and last
    # item is Neptune.
    axis_set = np.array([0.387098, 0.723331, 1.00000011, 1.523662, 5.203363,
                         9.537070, 19.191263, 30.068963]) * AU
    e_set = np.array([0.206, 0.007, 0.017, 0.093, 0.048, 0.056, 0.046, 0.010])
    mass_set = np.array([0.330, 4.87, 5.97, 0.642, 1898, 568, 86.8,
                         102]) * 10**(24)
    names = ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn',
             'Uranus', 'Neptune']
    colors = ['red', 'yellow', 'blue', 'red', 'red', 'orange', 'cyan', 'blue']
    pensize = [1/13, 3/13, 4/13, 26/13, 2, 26/13, 20/13, 19/13]

    a = axis_set[planet]
    e = e_set[planet]
    m2 = mass_set[planet]
    m1 = 2e30                                   # Larger body: the sun
    x0 = a * (1 + e)                            # initial position
    v_y0 = sqrt(G * (m1 + m2) * (2/x0 - 1/a))   # initial velocity of sm. body
    color = colors[planet]
    name = names[planet]
    size = pensize[planet]

    # Declare initial positions and velocities for two bodies. Assume more
    # massive body is stationary
    sun_loc = np.array([0, 0])
    sun_vel = np.array([0, 0])
    planet_loc = np.array([x0, 0])
    planet_vel = np.array([0, v_y0])

    # Create body objects
    sun = Body('Sun', m1, 'yellow', sun_loc, sun_vel, 40, True)
    planet = Body(name, m2, color, planet_loc, planet_vel, size, False)

    # Do the actual work
    time, pos_data = solve_system([sun, planet], 24*3600)
    animate(time, pos_data)
开发者ID:emcangi,项目名称:Nbody,代码行数:51,代码来源:3+body+sim+RK.py

示例15: main

def main() :
    screen = turtle.Screen()
    screen.setworldcoordinates(0,0,100,100)
    screen.tracer(1000)
    turtle.bgcolor("yellow")
    pen = turtle.Turtle()
    pen.hideturtle()
    pen.up()
    drawNose(pen)
    drawEyes(pen)
    drawMouth(pen)
    drawEars(pen)
    drawHair(pen)
    screen.exitonclick()
开发者ID:jbacon,项目名称:DataMiningPythonPrograms,代码行数:14,代码来源:SimpleSpongeBobFace.py


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