Gravity simulation

Let's now simulate gravity. We will simulate the movement of four planets (Mercury, Venus, Earth, and Mars), and our very own Moon, using Newton's law of universal gravitation.

Our simulation assumes the Sun at the center, but it does not draw an oval for the Sun as that would make our planets invisible at that scale. Our simulation programs shows the four planets and moon revolving in circular orbits (8.07_gravity_simulation.py):

While the system could be extended to include other planets from the solar system - putting them all on the rectangular window of our screen would not be possible as the differences in planet sizes ...

Get Tkinter GUI Application Development Blueprints - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.