MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Lib/turtledemo/planet_and_moon.py:67–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65## create compound yellow/blue turtleshape for planets
66
67def 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
106if __name__ == '__main__':
107 main()

Callers 1

planet_and_moon.pyFile · 0.70

Calls 15

addcomponentMethod · 0.95
initMethod · 0.95
startMethod · 0.95
TurtleClass · 0.90
ShapeClass · 0.90
GravSysClass · 0.85
StarClass · 0.85
getscreenMethod · 0.80
ltMethod · 0.80
begin_polyMethod · 0.80
circleMethod · 0.80
end_polyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…