Back to index

python3.2  3.2.2
Classes | Functions | Variables
turtledemo.planet_and_moon Namespace Reference

Classes

class  GravSys
class  Star

Functions

def main
 create compound yellow/blue turtleshape for planets

Variables

int G = 8
tuple msg = main()

Function Documentation

create compound yellow/blue turtleshape for planets

Definition at line 71 of file planet_and_moon.py.

00071 
00072 def main():
00073     s = Turtle()
00074     s.reset()
00075     s.getscreen().tracer(0,0)
00076     s.ht()
00077     s.pu()
00078     s.fd(6)
00079     s.lt(90)
00080     s.begin_poly()
00081     s.circle(6, 180)
00082     s.end_poly()
00083     m1 = s.get_poly()
00084     s.begin_poly()
00085     s.circle(6,180)
00086     s.end_poly()
00087     m2 = s.get_poly()
00088 
00089     planetshape = Shape("compound")
00090     planetshape.addcomponent(m1,"orange")
00091     planetshape.addcomponent(m2,"blue")
00092     s.getscreen().register_shape("planet", planetshape)
00093     s.getscreen().tracer(1,0)
00094 
00095     ## setup gravitational system
00096     gs = GravSys()
00097     sun = Star(1000000, Vec(0,0), Vec(0,-2.5), gs, "circle")
00098     sun.color("yellow")
00099     sun.shapesize(1.8)
00100     sun.pu()
00101     earth = Star(12500, Vec(210,0), Vec(0,195), gs, "planet")
00102     earth.pencolor("green")
00103     earth.shapesize(0.8)
00104     moon = Star(1, Vec(220,0), Vec(0,295), gs, "planet")
00105     moon.pencolor("blue")
00106     moon.shapesize(0.5)
00107     gs.init()
00108     gs.start()
00109     return "Done!"


Variable Documentation

Definition at line 23 of file planet_and_moon.py.

Definition at line 111 of file planet_and_moon.py.