本文整理汇总了Python中turtle.bgcolor函数的典型用法代码示例。如果您正苦于以下问题:Python bgcolor函数的具体用法?Python bgcolor怎么用?Python bgcolor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bgcolor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: plot_by_magnitude
def plot_by_magnitude(picture_size, coordinates_dict, magnitudes_dict):
length = int(picture_size / 2)
turtle.bgcolor("black")
turtle.color("white")
for number in all_drapers:
mag = magnitudes_dict[number]
star_size = round(10.0 / (mag + 2))
if star_size > 8:
star_size = 8
x = coordinates_dict[number][0] * length
y = coordinates_dict[number][1] * length
turtle.pu()
turtle.setpos(x, y)
draw_square(star_size)
开发者ID:Benjamin-George,项目名称:Star-Map,代码行数:14,代码来源:Draw+Stars.py
示例17: paintInit
def paintInit():
width = 500
height = 680
x = 100
y = 0
turtle.setup(width, height, x, y)
turtle.pensize(3)
turtle.bgcolor("#FFFE88")
turtle.penup()
turtle.left(90)
turtle.forward(150)
turtle.left(-90)
turtle.backward(50)
turtle.pendown()
开发者ID:YinZhongkai,项目名称:MyProject,代码行数:14,代码来源:rose.py
示例18: graphicsInit
def graphicsInit(title,bgcolor,s_width,s_height):
global width
width = s_width
global height
height = s_height
# hideturtle() same as ht()
g.hideturtle()
# SetWindowResolution
#turtle.setup (width=200, height=200, startx=0, starty=0)
turtle.setup(width, height, 0, 0)
g.speed(0)
g.tracer(1,0)
#g.goto(0,0);
turtle.title(title)
turtle.bgcolor(bgcolor)
开发者ID:Tryan18,项目名称:Python,代码行数:15,代码来源:TurtleDrawLib.py
示例19: main
def main():
"""
The main function.
:pre: (relative) pos (0,0), heading (east)
:post: (relative) pos (0,0), heading (east)
:return: None
"""
# the lumber required by the house
hlumber = 0
turtle.bgcolor('black')
turtle.pencolor('white')
init()
# Number of trees required by the user
treeNo = int(input('Enter the number of trees '))
isHouse = input('Is there a house in the forest (y/n)? ')
# generates the house at random locations
if isHouse == 'y':
if treeNo >=2 :
houseNo = random.randint(1, treeNo-1)
else:
print('There have to be atleast 2 trees for the house to be printed')
houseNo = 0
tlumber = drawTree(treeNo, isHouse, houseNo)
hlumber = 2 * 50 + 50 * math.sqrt(2) + 50 * math.sqrt(2) + 2 * 50
else:
tlumber = drawTree(treeNo, isHouse, 0)
# draws the star 10 pixels higher than the highest tree
hStar = max(treeHt) + UNIT + 10
drawstar(hStar)
# Total lumber from the trees and the house
lumber = hlumber + tlumber
wallht = lumber/(2 + math.sqrt(2))
input('Night is done, press enter for day')
turtle.reset()
init()
turtle.bgcolor('white')
turtle.pencolor('black')
input('We have ' + str(lumber) + ' units of lumber for the building.')
input('We will build a house with walls ' + str(wallht) + ' tall.')
drawHouse(wallht/2)
drawSpace()
turtle.left(90)
turtle.forward(wallht * 2)
drawSun()
input('Day is done, house is built, press enter to quit')
开发者ID:pavanbhat,项目名称:Python-Labs,代码行数:48,代码来源:forest.py
示例20: main
def main():
# 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()
yin_thread = Thread(target=draw_yin)
yang_thread = Thread(target=draw_yang)
yin_thread.start()
yang_thread.start()
开发者ID:mwoinoski,项目名称:crs1906,代码行数:16,代码来源:yinyang_multithreaded.py
注:本文中的turtle.bgcolor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论