()
| 65 | ## create compound yellow/blue turtleshape for planets |
| 66 | |
| 67 | def main(): |
| 68 | s = Turtle() |
| 69 | s.reset() |
| 70 | s.getscreen().tracer(0,0) |
| 71 | s.ht() |
| 72 | s.pu() |
| 73 | s.fd(6) |
| 74 | s.lt(90) |
| 75 | s.begin_poly() |
| 76 | s.circle(6, 180) |
| 77 | s.end_poly() |
| 78 | m1 = s.get_poly() |
| 79 | s.begin_poly() |
| 80 | s.circle(6,180) |
| 81 | s.end_poly() |
| 82 | m2 = s.get_poly() |
| 83 | |
| 84 | planetshape = Shape("compound") |
| 85 | planetshape.addcomponent(m1,"orange") |
| 86 | planetshape.addcomponent(m2,"blue") |
| 87 | s.getscreen().register_shape("planet", planetshape) |
| 88 | s.getscreen().tracer(1,0) |
| 89 | |
| 90 | ## setup gravitational system |
| 91 | gs = GravSys() |
| 92 | sun = Star(1000000, Vec(0,0), Vec(0,-2.5), gs, "circle") |
| 93 | sun.color("yellow") |
| 94 | sun.shapesize(1.8) |
| 95 | sun.pu() |
| 96 | earth = Star(12500, Vec(210,0), Vec(0,195), gs, "planet") |
| 97 | earth.pencolor("green") |
| 98 | earth.shapesize(0.8) |
| 99 | moon = Star(1, Vec(220,0), Vec(0,295), gs, "planet") |
| 100 | moon.pencolor("blue") |
| 101 | moon.shapesize(0.5) |
| 102 | gs.init() |
| 103 | gs.start() |
| 104 | return "Done!" |
| 105 | |
| 106 | if __name__ == '__main__': |
| 107 | main() |
no test coverage detected
searching dependent graphs…