Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. from pptx import Presentation
  2. import os
  3.  
  4. #* Finding and opening the template file to write to
  5. file = os.path.dirname(os.path.realpath(__file__))
  6. prs = Presentation(file + '\\Template.pptx')
  7.  
  8. #* Creating the title layout
  9. title_slide_layout = prs.slide_layouts[0]
  10. slide = prs.slides.add_slide(title_slide_layout)
  11.  
  12. # * Creating the title object
  13. title = slide.shapes.title
  14. subtitle = slide.placeholders[1]
  15.  
  16. # * Creating the slide layout
  17. mainslidelayout = prs.slide_layouts[1]
  18.  
  19. #* Creating the different slides with the layout from mainslidelayout
  20. S1 = prs.slides.add_slide(mainslidelayout)
  21. S2 = prs.slides.add_slide(mainslidelayout)
  22. S3 = prs.slides.add_slide(mainslidelayout)
  23. S4 = prs.slides.add_slide(mainslidelayout)
  24. S5 = prs.slides.add_slide(mainslidelayout)
  25. S6 = prs.slides.add_slide(mainslidelayout)
  26.  
  27.  
  28. #* Setting the title text and subtitle
  29. title.text = "The Arctic Treaty"
  30. subtitle.text = "Generated in python because I was bored"
  31.  
  32. #* Creating the objects for slide1
  33. t1 = S1.shapes.title
  34. sub1 = S1.placeholders[1]
  35.  
  36. #* Seting the text for slide1
  37.  
  38. t1.text = "What is the Antartic Treaty?"
  39. sub1.text = "The Antartic Treaty is a Treaty that has been signed by twelve countries (Governments of Argentina, Australia, Belgium, Chile, the French Republic, Japan, New Zealand, Norway, the Union of South Africa, the Union of Soviet Socialist Republics, the United Kingdom of Great Britain and Northern Ireland, and the United States of America) that prohibits the use of Antartica for non peaceful purposes."\
  40. "The Antartic Treaty allows all members of the Treaty to freely carry out scientific research in Antartica. The Antartic Treaty also forbids the assertion or ownership of land, all land is accessible by all members. Nuclear activity in Antartica is strictly prohibited to protect the wildlife there"
  41.  
  42. #* Creating the slide2 objects
  43. t2 = S2.shapes.title
  44. sub2 = S2.placeholders[1]
  45.  
  46. #* Slide2 text
  47. t2.text = "Who is involved?"
  48. sub2.text = "The Governments of 12 countries have signed the Treaty on the behalf of their country, these countries are: Governments of Argentina, Australia, Belgium, Chile, the French Republic, Japan, New Zealand, Norway, the Union of South Africa, the Union of Soviet Socialist Republics, the United Kingdom of Great Britain and Northern Ireland, and the United States of America."
  49.  
  50. #* Creating slide3 objects
  51. t3 = S3.shapes.title
  52. sub3 = S3.placeholders[1]
  53.  
  54. #* Setting slide3 text
  55. t3.text = "What is the aim?"
  56. sub3.text = "The aim of the Treaty is to protect Antartica and its inhabitants and wildlife from damage. Antartica is an incredibly large and unexplored area and scientists have yet to fully explore it. Antartica is also very unstable, this is why its so expensive to travel there."\
  57. "Antartica has been demilitarized, in order to comply with these rules and give all members equal power within the area."
  58.  
  59. #* Creating the slide4 objects
  60. t4 = S4.shapes.title
  61. sub4 = S4.placeholders[1]
  62.  
  63. #* Setting the slide4 text
  64. t4.text = "What are the main points?"
  65. sub4.text = "The main points of the Antarctic Treaty are as follows:\n-Nobody owns Antarctica \n-Antarctica can be freely accesed by all parties \n-Antarctica cannot be militarized \n-Antarctica's seas are not affected by the Treaty \n-Antarctica's stations can be freely inspected by all parties"
  66.  
  67. #* Creating the slide 5 objects
  68. t5 = S5.shapes.title
  69. sub5 = S5.placeholders[1]
  70.  
  71. #* Setting the slide5 text
  72. t5.text = "Is the Treaty good?"
  73. sub5.text = "I think that the Treaty is a good start, however I think that the seas surrounding Antartica should also be protected from unpermitted visitors as a lot of the Antarctic animals are being affected by the pollution given off by the scientists travelling there."
  74.  
  75. #* Creating the slide6 object
  76. t6 = S6.shapes.title
  77. sub6 = S6.placeholders[1]
  78.  
  79. #* Setting the slide6 text
  80. t6.text = "How was this powerpoint made?"
  81. sub6.text = "This powerpoint was not actually written in powerpoint, I wrote a script in a programming language called python to create it. Everything here has been generated from this script. A link to the script can be found here: "
  82.  
  83. #* Saving it as Geography.pptx
  84. prs.save('Geography.pptx')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement