{|j ~ d Z ddlmZmZmZmZ dZ G d de Z G d de Z
d Zed k( r e e y
y
)a turtle-example-suite:
tdemo_planets_and_moon.py
Gravitational system simulation using the
approximation method from Feynman-lectures,
p.9-8, using turtlegraphics.
Example: heavy central body, light planet,
very light moon!
Planet has a circular orbit, moon a stable
orbit around the planet.
You can hold the movement temporarily by
pressing the left mouse button with the
mouse over the scrollbar of the canvas.
)ShapeTurtlemainloopVec2D c e Zd Zd Zd Zd Zy)GravSysc . g | _ d| _ d| _ y )Nr g{Gz?)planetstdt)selfs 3/usr/lib64/python3.12/turtledemo/planet_and_moon.py__init__zGravSys.__init__ s c F | j D ] }|j y )N)r init)r ps r r zGravSys.init s A
FFH r c t d D ]B }| xj | j z
c_ | j D ] }|j D y )Ni' )ranger r
r step)r ir s r startz
GravSys.start s9 uAFFdggF\\ " r N)__name__
__module____qualname__r r r r r r r s r r c $ e Zd Zd Zd Zd Zd Zy)Starc t j | | | j || _ | j | || _ |j j | || _ | j d | j y )N)shapeuser)r r penupmsetposvr appendgravSys
resizemodependown)r r$ xr&