-
Notifications
You must be signed in to change notification settings - Fork 0
/
planets.py
631 lines (441 loc) · 35.4 KB
/
planets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
import tkinter as tk
from tkinter import ttk
from tkinter import *
import PIL
from PIL import ImageTk, Image
FULL_EARTH_DESC = 'Our home planet is the third planet from the Sun\n and the only place we know of so far that’s inhabited \nby living things.\n\n\nWhile Earth is only the fifth largest planet\nin the solar system, it is the only world\nin our solar system with liquid water on the surface.\nJust slightly larger than nearby Venus. Earth is\nthe biggest of the four planets closest to the Sun,\nall of which are made of rock and metal.\n\n\nThe name Earth is at least 1,000 years old.\nAll of the planets, except for Earth were named after Greek\nand Roman gods and goddesses.\nHowever, the name Earth is a Germanic word\nwhich simply means “the ground.”'
EARTH_FACT = '" Humans are the primary inahbitants of this beautiful planet, but they treat it very poorly... "'
FULL_JUPITER_DESC = 'Jupiter has a long history surprising \nscientists—all the way back to 1610 when Galileo Galilei \nfound the first moons beyond Earth. \nThat discovery changed the way we see the universe.\n\n\nFifth in line from the Sun, Jupiter is, \nby far, the largest planet in the solar system \nmore than twice as massive as all \nthe other planets combined.\n\n\nJupiter\'s familiar stripes \nand swirls are actually cold, windy clouds \nof ammonia and water, floating in an atmosphere of \nhydrogen and helium. Jupiter’s iconic Great Red Spot \nis a giant storm bigger than Earth that has \nraged for hundreds of years.'
JUPITER_FACT = 'One spacecraft — NASA\'s Juno orbiter — is currently exploring this giant world.'
FULL_NEPTUNE_DESC = 'Dark, cold and whipped by supersonic winds, \nice giant Neptune is the eighth and most distant \nplanet in our solar system.\n\n\nMore than 30 times as far from the Sun as Earth, Neptune \nis the only planet in our solar system not visible to the \nnaked eye and the first predicted by \nmathematics before its discovery. In 2011\nNeptune completed its first 165-year \norbit since its discovery in 1846.\n\n\n NASA\'s Voyager 2 is the only spacecraft \nto have visited Neptune up close. It flew past in \n1989 on its way out of the solar system.'
NEPTUNE_FACT = 'Neptune has 14 moons! \nThe most interesting moon is Triton, a frozen world that is spewing nitrogen ice and dust particles out from below its surface.\nIt was likely captured by the gravitationalnpull of Neptune. It is probably the coldest world in the solar system.'
FULL_MARS_DESC = 'The fourth planet from the Sun, \nMars is a dusty, cold, \ndesert world with a very thin atmosphere.\n\n\nThis dynamic planet has seasons, \npolar ice caps and weather and canyons and \nextinct volcanoes, evidence it was once \nan even more active past\n\n\n Mars is one of the most explored bodies \nin our solar system, and it\'s the only planet \nwhere we\'ve sent rovers to roam the\nalien landscape. NASA currently has three spacecraft \nin orbit, one rover and one lander on the surface.\nIndia and ESA also have spacecraft in orbit above Mars.\nThese robotic explorers have found lots of \nevidence that Mars was much wetter and warmer, \nwith a thicker atmosphere, \nbillions of years ago. NASA launched the next-generation \nPerseverance rover to Mars on July 30,2020.'
MARS_FACT = 'NASA\'s latest robotic mission to the Red Planet, Mars 2020, aims to help future astronauts \nbrave that inhospitable landscape.'
FULL_SATURN_DESC = 'Saturn is the sixth planet from the Sun \nand the second largest planet in our solar system.\n\n\nAdorned with thousands of beautiful ringlets,\n Saturn is unique among the planets. It is\nnot the only planet to have rings—made \nof chunks of ice and rock—but none \nare as spectacular or as complicated as Saturn\'s.\n\n\n Like fellow gas giant Jupiter, Saturn is a massive \nball made mostly of hydrogen and helium.'
SATURN_FACT = 'Nine Earths side by side would almost span Saturn’s diameter. That doesn’t include Saturn’s rings.'
FULL_VENUS_DESC = 'Venus is the second planet from the Sun and our \nclosest planetary neighbor. Similar in structure and size to \nEarth, Venus spins slowly in the opposite direction from \nmost planets.Its thick atmosphere traps heat in a runaway \ngreenhouse effect, making it the hottest planet \nin our solar system with surface temperatures hot enough \nto melt lead. Glimpses below the clouds \nreveal volcanoes and deformed mountains.\n\n\n Venus is named for the ancient Roman goddess of love \nand beauty, who was known as Aphrodite \nto the Ancient Greeks.'
VENUS_FACT = 'With a radius of 3,760 miles, Venus is roughly the same size as Earth — just slightly smaller'
FULL_URANUS_DESC = 'The first planet found with the aid of a telescope\nUranus was discovered in 1781 by astronomer William Herschel\n although he originally thought it was either a comet or a star.\n\n\nIt was two years later that the object was \nuniversally accepted as a new planet, \nin part because of observations by astronomer Johann Elert Bode.\nHerschel tried unsuccessfully to name his discovery \nGeorgium Sidus after King George III. Instead the \nscientific community accepted Bode\'s suggestion to name \nit Uranus, the Greek god of the sky, \nas suggested by Bode.'
URANUS_FACT = 'Uranus is known as the “sideways planet” because it rotates on its side.'
FULL_MERCURY_DESC = 'The smallest planet in our solar system and \nnearest to the Sun, Mercury is only \nslightly larger than Earth\'s Moon.\n\n\n From the surface of Mercury, the Sun would \nappear more than three times as large as it \ndoes when viewed from Earth,\nand the sunlight would be as \nmuch as seven times brighter. Despite its \nproximity to the Sun, Mercury is not the hottest \nplanet in our solar system \nthat title belongs to nearby Venus, \nthanks to its dense atmosphere.'
MERCURY_FACT = 'It is the closest planet to the Sun at a distance of about 36 million miles (58 million kilometers)'
FULL_PLUTO_DESC = 'Pluto—which is smaller than Earth’s Moon\nhas a heart-shaped glacier that’s the size of Texas\nThis fascinating world has blue skies, \nspinning moons, mountains as high as the Rockies\nand it snows—but the snow is red.\n\n\n Pluto’s atmosphere is thin and composed \nmostly of nitrogen, methane and carbon monoxide.\n\n\nPluto got its name from 11-year-old \nVenetia Burney of Oxford, England'
PLUTO_FACT = 'Pluto (minor planet designation: 134340 Pluto) is an icy dwarf planet in the Kuiper belt, a ring of bodies beyond the orbit of Neptune'
HEIGHT = 700
WIDTH = 900
root = tk.Tk()
root.title('Welcome to Terra Planets')
def planet(event):
planet_type = clicked.get()
if planet_type == option[0]: # EARTH
image = Image.open("earth.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_EARTH_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=EARTH_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[1]: # Jupiter
image = Image.open("jupiter.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
planet_label = tk.Label(desc_frame, text=FULL_JUPITER_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
planet_label.pack()
planet_fact = tk.Label(fact_frame, text=JUPITER_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
planet_fact.pack(side='left')
item4.pack()
if planet_type == option[2]: # Neptune
image = Image.open("neptune.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
planet_label = tk.Label(desc_frame, text=FULL_NEPTUNE_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
planet_label.pack()
planet_fact = tk.Label(fact_frame, text=NEPTUNE_FACT,font=('Monotype Corsiva', 13), bg='#121212', fg='white')
planet_fact.pack(side='left')
item4.pack()
if planet_type == option[3]: # Mars
image = Image.open("mars.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
planet_label = tk.Label(desc_frame, text=FULL_MARS_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
planet_label.pack()
planet_fact = tk.Label(fact_frame, text=MARS_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
planet_fact.pack(side='left')
item4.pack()
if planet_type == option[4]: # Saturn
image = Image.open("saturn.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_SATURN_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=SATURN_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[5]: # Venus
image = Image.open("venus.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_VENUS_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=VENUS_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[6]: # Uranus
image = Image.open("uranus.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_VENUS_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=URANUS_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[7]: # Mercury
image = Image.open("mercury.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_MERCURY_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=MERCURY_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[8]: # Pluto
image = Image.open("pluto.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_PLUTO_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=PLUTO_FACT,font=('Monotype Corsiva', 12), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH, bg='#171717')
canvas.pack()
desc_frame = tk.Frame(root, bg='#121212') # This should have sliding bar for information
desc_frame.place(relx=0.6, rely=0.1, relheight=0.6, relwidth=0.35)
fact_frame = tk.Frame(root, bg='#121212')
fact_frame.place(relx=0.05, rely=0.72, relheight=0.2, relwidth=0.9)
option = ['Earth','Jupiter','Neptune','Mars','Saturn','Venus','Uranus','Mercury', 'Pluto'] # dropdown menu options
clicked = StringVar()
clicked.set(option[0])
drop = OptionMenu(root, clicked, *option)
drop.place(relx=0.3, rely=0.01, relheight=0.05, relwidth=0.1)
button = tk.Button(canvas, text='Get Info')
button.bind('<Button-1>', planet)
button.place(relx=0.4, rely=0.01, relheight=0.05, relwidth=0.1)
text = 'Welcome to the Planet App!\n \n \n Choose a planet to get started...\n\n\n Project by Anthony Terrano'
text2 = 'Fun Facts will show up in this box here!'
initial_label2 = tk.Label(fact_frame, text=text2, font=('Monotype Corsiva', 18), bg='#121212', fg='white')
initial_label2.pack(side='left')
initial_label = tk.Label(desc_frame, text=text, font=('Gadugi', 12), bg='#121212', fg='white')
initial_label.pack()
root.mainloop()import tkinter as tk
from tkinter import ttk
from tkinter import *
import PIL
from PIL import ImageTk, Image
FULL_EARTH_DESC = 'Our home planet is the third planet from the Sun\n and the only place we know of so far that’s inhabited \nby living things.\n\n\nWhile Earth is only the fifth largest planet\nin the solar system, it is the only world\nin our solar system with liquid water on the surface.\nJust slightly larger than nearby Venus. Earth is\nthe biggest of the four planets closest to the Sun,\nall of which are made of rock and metal.\n\n\nThe name Earth is at least 1,000 years old.\nAll of the planets, except for Earth were named after Greek\nand Roman gods and goddesses.\nHowever, the name Earth is a Germanic word\nwhich simply means “the ground.”'
EARTH_FACT = '" Humans are the primary inahbitants of this beautiful planet, but they treat it very poorly... "'
FULL_JUPITER_DESC = 'Jupiter has a long history surprising \nscientists—all the way back to 1610 when Galileo Galilei \nfound the first moons beyond Earth. \nThat discovery changed the way we see the universe.\n\n\nFifth in line from the Sun, Jupiter is, \nby far, the largest planet in the solar system \nmore than twice as massive as all \nthe other planets combined.\n\n\nJupiter\'s familiar stripes \nand swirls are actually cold, windy clouds \nof ammonia and water, floating in an atmosphere of \nhydrogen and helium. Jupiter’s iconic Great Red Spot \nis a giant storm bigger than Earth that has \nraged for hundreds of years.'
JUPITER_FACT = 'One spacecraft — NASA\'s Juno orbiter — is currently exploring this giant world.'
FULL_NEPTUNE_DESC = 'Dark, cold and whipped by supersonic winds, \nice giant Neptune is the eighth and most distant \nplanet in our solar system.\n\n\nMore than 30 times as far from the Sun as Earth, Neptune \nis the only planet in our solar system not visible to the \nnaked eye and the first predicted by \nmathematics before its discovery. In 2011\nNeptune completed its first 165-year \norbit since its discovery in 1846.\n\n\n NASA\'s Voyager 2 is the only spacecraft \nto have visited Neptune up close. It flew past in \n1989 on its way out of the solar system.'
NEPTUNE_FACT = 'Neptune has 14 moons! \nThe most interesting moon is Triton, a frozen world that is spewing nitrogen ice and dust particles out from below its surface.\nIt was likely captured by the gravitationalnpull of Neptune. It is probably the coldest world in the solar system.'
FULL_MARS_DESC = 'The fourth planet from the Sun, \nMars is a dusty, cold, \ndesert world with a very thin atmosphere.\n\n\nThis dynamic planet has seasons, \npolar ice caps and weather and canyons and \nextinct volcanoes, evidence it was once \nan even more active past\n\n\n Mars is one of the most explored bodies \nin our solar system, and it\'s the only planet \nwhere we\'ve sent rovers to roam the\nalien landscape. NASA currently has three spacecraft \nin orbit, one rover and one lander on the surface.\nIndia and ESA also have spacecraft in orbit above Mars.\nThese robotic explorers have found lots of \nevidence that Mars was much wetter and warmer, \nwith a thicker atmosphere, \nbillions of years ago. NASA launched the next-generation \nPerseverance rover to Mars on July 30,2020.'
MARS_FACT = 'NASA\'s latest robotic mission to the Red Planet, Mars 2020, aims to help future astronauts \nbrave that inhospitable landscape.'
FULL_SATURN_DESC = 'Saturn is the sixth planet from the Sun \nand the second largest planet in our solar system.\n\n\nAdorned with thousands of beautiful ringlets,\n Saturn is unique among the planets. It is\nnot the only planet to have rings—made \nof chunks of ice and rock—but none \nare as spectacular or as complicated as Saturn\'s.\n\n\n Like fellow gas giant Jupiter, Saturn is a massive \nball made mostly of hydrogen and helium.'
SATURN_FACT = 'Nine Earths side by side would almost span Saturn’s diameter. That doesn’t include Saturn’s rings.'
FULL_VENUS_DESC = 'Venus is the second planet from the Sun and our \nclosest planetary neighbor. Similar in structure and size to \nEarth, Venus spins slowly in the opposite direction from \nmost planets.Its thick atmosphere traps heat in a runaway \ngreenhouse effect, making it the hottest planet \nin our solar system with surface temperatures hot enough \nto melt lead. Glimpses below the clouds \nreveal volcanoes and deformed mountains.\n\n\n Venus is named for the ancient Roman goddess of love \nand beauty, who was known as Aphrodite \nto the Ancient Greeks.'
VENUS_FACT = 'With a radius of 3,760 miles, Venus is roughly the same size as Earth — just slightly smaller'
FULL_URANUS_DESC = 'The first planet found with the aid of a telescope\nUranus was discovered in 1781 by astronomer William Herschel\n although he originally thought it was either a comet or a star.\n\n\nIt was two years later that the object was \nuniversally accepted as a new planet, \nin part because of observations by astronomer Johann Elert Bode.\nHerschel tried unsuccessfully to name his discovery \nGeorgium Sidus after King George III. Instead the \nscientific community accepted Bode\'s suggestion to name \nit Uranus, the Greek god of the sky, \nas suggested by Bode.'
URANUS_FACT = 'Uranus is known as the “sideways planet” because it rotates on its side.'
FULL_MERCURY_DESC = 'The smallest planet in our solar system and \nnearest to the Sun, Mercury is only \nslightly larger than Earth\'s Moon.\n\n\n From the surface of Mercury, the Sun would \nappear more than three times as large as it \ndoes when viewed from Earth,\nand the sunlight would be as \nmuch as seven times brighter. Despite its \nproximity to the Sun, Mercury is not the hottest \nplanet in our solar system \nthat title belongs to nearby Venus, \nthanks to its dense atmosphere.'
MERCURY_FACT = 'It is the closest planet to the Sun at a distance of about 36 million miles (58 million kilometers)'
FULL_PLUTO_DESC = 'Pluto—which is smaller than Earth’s Moon\nhas a heart-shaped glacier that’s the size of Texas\nThis fascinating world has blue skies, \nspinning moons, mountains as high as the Rockies\nand it snows—but the snow is red.\n\n\n Pluto’s atmosphere is thin and composed \nmostly of nitrogen, methane and carbon monoxide.\n\n\nPluto got its name from 11-year-old \nVenetia Burney of Oxford, England'
PLUTO_FACT = 'Pluto (minor planet designation: 134340 Pluto) is an icy dwarf planet in the Kuiper belt, a ring of bodies beyond the orbit of Neptune'
HEIGHT = 700
WIDTH = 900
root = tk.Tk()
root.title('Welcome to Terra Planets')
def planet(event):
planet_type = clicked.get()
if planet_type == option[0]: # EARTH
image = Image.open("earth.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_EARTH_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=EARTH_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[1]: # Jupiter
image = Image.open("jupiter.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
planet_label = tk.Label(desc_frame, text=FULL_JUPITER_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
planet_label.pack()
planet_fact = tk.Label(fact_frame, text=JUPITER_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
planet_fact.pack(side='left')
item4.pack()
if planet_type == option[2]: # Neptune
image = Image.open("neptune.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
planet_label = tk.Label(desc_frame, text=FULL_NEPTUNE_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
planet_label.pack()
planet_fact = tk.Label(fact_frame, text=NEPTUNE_FACT,font=('Monotype Corsiva', 13), bg='#121212', fg='white')
planet_fact.pack(side='left')
item4.pack()
if planet_type == option[3]: # Mars
image = Image.open("mars.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
planet_label = tk.Label(desc_frame, text=FULL_MARS_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
planet_label.pack()
planet_fact = tk.Label(fact_frame, text=MARS_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
planet_fact.pack(side='left')
item4.pack()
if planet_type == option[4]: # Saturn
image = Image.open("saturn.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_SATURN_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=SATURN_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[5]: # Venus
image = Image.open("venus.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_VENUS_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=VENUS_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[6]: # Uranus
image = Image.open("uranus.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_VENUS_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=URANUS_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[7]: # Mercury
image = Image.open("mercury.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_MERCURY_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=MERCURY_FACT,font=('Monotype Corsiva', 16), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
if planet_type == option[8]: # Pluto
image = Image.open("pluto.png")
basewidth = 400
canvas2 = tk.Canvas(root, height=400, width=400, bg='#171717',bd=0, highlightthickness=0, relief='ridge')
wpercent = (basewidth / float(image.size[0]))
hsize = int((float(image.size[1]) * float(wpercent)))
image = image.resize((basewidth, hsize), PIL.Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
item4 = canvas2.create_image(225, 210, image=photo)
canvas2.place(relx=0.05, rely=0.1, relheight=0.6, relwidth=0.5)
for widget in desc_frame.winfo_children():
widget.destroy()
for widget in fact_frame.winfo_children():
widget.destroy()
earth_label = tk.Label(desc_frame, text=FULL_PLUTO_DESC, font=('Gadugi', 9), bg='#121212', fg='white')
earth_label.pack()
earth_fact = tk.Label(fact_frame, text=PLUTO_FACT,font=('Monotype Corsiva', 12), bg='#121212', fg='white')
earth_fact.pack(side='left')
item4.pack()
canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH, bg='#171717')
canvas.pack()
desc_frame = tk.Frame(root, bg='#121212') # This should have sliding bar for information
desc_frame.place(relx=0.6, rely=0.1, relheight=0.6, relwidth=0.35)
fact_frame = tk.Frame(root, bg='#121212')
fact_frame.place(relx=0.05, rely=0.72, relheight=0.2, relwidth=0.9)
option = ['Earth','Jupiter','Neptune','Mars','Saturn','Venus','Uranus','Mercury', 'Pluto'] # dropdown menu options
clicked = StringVar()
clicked.set(option[0])
drop = OptionMenu(root, clicked, *option)
drop.place(relx=0.3, rely=0.01, relheight=0.05, relwidth=0.1)
button = tk.Button(canvas, text='Get Info')
button.bind('<Button-1>', planet)
button.place(relx=0.4, rely=0.01, relheight=0.05, relwidth=0.1)
text = 'Welcome to the Planet App!\n \n \n Choose a planet to get started...\n\n\n Project by Anthony Terrano'
text2 = 'Fun Facts will show up in this box here!'
initial_label2 = tk.Label(fact_frame, text=text2, font=('Monotype Corsiva', 18), bg='#121212', fg='white')
initial_label2.pack(side='left')
initial_label = tk.Label(desc_frame, text=text, font=('Gadugi', 12), bg='#121212', fg='white')
initial_label.pack()
root.mainloop()