0% found this document useful (0 votes)
19 views2 pages

#Celestial View of Space

Python Programme

Uploaded by

neeraj1332sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

#Celestial View of Space

Python Programme

Uploaded by

neeraj1332sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#Celestial View of Space

#Modules
import turtle
import time
from math import math

#Trigger Command

def Gravitation_Celestial():
pass
#Backdrop

screen = turtle.Screen()
screen.tracer(50)
turtle.bgpic("Sp.png")

#Sun

sun = turtle.Turtle()
sun.shape('circle')
sun.color('DarkGoldenrod1')

#Core Code

class Planet(turtle.Turtle):
def __init__(self,name,radius, color):#initialize function
super().__init__(shape='circle')
self.name = name
self.radius = radius
self.c = color
self.color(self.c)
self.up()
self.pd()
self.angle = 0
def move(self):
x = self.radius*cos(self.angle) # Angle in radians
y = self.radius*sin(self.angle)

self.goto(sun.xcor()+x,sun.ycor()+y)

mercury = Planet("Mercury",40, 'DarkOrange1')


venus = Planet("Venus",80, 'coral2')
earth=Planet("Earth",100,'blue2')
mars = Planet("Mars",150, 'chocolate2')
jupiter=Planet("Jupiter",180, 'burlywood2')
saturn=Planet("Saturn",230, 'burlywood3')
uranus=Planet("Uranus",250, 'Cyan3')
neptune=Planet("Neptune",280, 'DarkTurquoise')

#Planet List
Planet_list = [ mercury, venus,earth, mars,jupiter,saturn,uranus,neptune]

while True:
screen.update() #Updating the screen
for i in Planet_list:
i.move() #Motion
# Inc. the angle by 0.0x radians to maintain relative speeds

mercury.angle += 0.05
venus.angle += 0.03
earth.angle += 0.01
mars.angle += 0.007

jupiter.angle += 0.02
saturn.angle += 0.018
uranus.angle += 0.016
neptune.angle += 0.005

You might also like