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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.