Using code for a powerpoint is a useful approach to have chatgpt and other LLMs create powerpoint slides from documents or a textual description.
pip install -r requirements.txt
python make_powerpoint.py| from pptx import Presentation | |
| from pptx.util import Inches | |
| from pptx.enum.chart import XL_CHART_TYPE | |
| # Create a presentation object | |
| prs = Presentation() | |
| # Add a title slide | |
| slide_layout = prs.slide_layouts[0] # 0 is the layout for the title slide | |
| slide = prs.slides.add_slide(slide_layout) | |
| title = slide.shapes.title | |
| subtitle = slide.placeholders[1] | |
| title.text = "Welcome to the Presentation" | |
| subtitle.text = "This presentation contains text, a table, and a chart." | |
| # Add a slide with a title and content | |
| slide_layout = prs.slide_layouts[1] # 1 is the layout for title and content | |
| slide = prs.slides.add_slide(slide_layout) | |
| title = slide.shapes.title | |
| content = slide.placeholders[1] | |
| title.text = "Agenda" | |
| content.text = "1. Introduction\n2. Main Content\n3. Conclusion" | |
| # Add a slide with a table | |
| slide_layout = prs.slide_layouts[5] # 5 is the layout for title and content | |
| slide = prs.slides.add_slide(slide_layout) | |
| title = slide.shapes.title | |
| title.text = "Data Table" | |
| # Define table dimensions | |
| rows = 3 | |
| cols = 4 | |
| left = Inches(2) | |
| top = Inches(2) | |
| width = Inches(6) | |
| height = Inches(1.5) | |
| # Add table | |
| table = slide.shapes.add_table(rows, cols, left, top, width, height).table | |
| # Set column headings | |
| table.columns[0].width = Inches(1.5) | |
| table.columns[1].width = Inches(1.5) | |
| table.columns[2].width = Inches(1.5) | |
| table.columns[3].width = Inches(1.5) | |
| table.cell(0, 0).text = 'Header 1' | |
| table.cell(0, 1).text = 'Header 2' | |
| table.cell(0, 2).text = 'Header 3' | |
| table.cell(0, 3).text = 'Header 4' | |
| # Add data to the table | |
| table.cell(1, 0).text = 'Data 1' | |
| table.cell(1, 1).text = 'Data 2' | |
| table.cell(1, 2).text = 'Data 3' | |
| table.cell(1, 3).text = 'Data 4' | |
| table.cell(2, 0).text = 'Data 5' | |
| table.cell(2, 1).text = 'Data 6' | |
| table.cell(2, 2).text = 'Data 7' | |
| table.cell(2, 3).text = 'Data 8' | |
| prs.save('combined_presentation.pptx') |
| python-pptx |
from pptx import Presentation
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Larangan ASN dan Implementasinya"
subtitle.text = "Dibuat oleh ChatGPT | 2025"
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "Pendahuluan"
slide.placeholders[1].text = (
"ASN memiliki peran strategis dalam penyelenggaraan pemerintahan dan pelayanan publik. "
"Untuk menjaga integritas dan profesionalisme birokrasi, berbagai larangan diterapkan "
"agar ASN tidak terlibat dalam politik praktis, penyalahgunaan wewenang, atau konflik kepentingan."
)
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "Asas-asas Penyelenggaraan ASN"
slide.placeholders[1].text = (
"Berdasarkan UU
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.text import PP_ALIGN
prs = Presentation()
prs.slide_width = Inches(10)
prs.slide_height = Inches(7.5)
slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
title.text = "Formulation, Evaluation & Optimization\nof 1% Luliconazole Emulgel\nFor Fungal Diseases"
subtitle = slide.placeholders[1]
subtitle.text = "B.Pharm Project 2025-26\nSmt. B.N.B. Swaminarayan Pharmacy College"
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Project Team"
content = slide.placeholders[1]
content.text = "Patel Vishwa Shaileshbhai (222650290078)\nPathan Yasmin Ismail (222650290079)\nPrajapati Shreyansh Ketanbhai (222650290081)\nPrajapati Vini Nareshbhai (222650290082)\nRathod Dhvani Hitendra (222650290083)\n\nGuide: Dr. Anuradha P. Prajapati\nPrincipal: Dr. Sachin B. Narkhede"
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Abstract"
content = slide.placeholders[1]
content.text = "• 1% Luliconazole emulgel using Tefose 63, tea tree oil\n• pH 6.2, 100% drug content, 8-hr controlled release\n• Superior antifungal activity vs Candida/Trichophyton\n• Stable at 40°C/75%RH, beats market cream"
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Fungal Skin Infections"
content = slide.placeholders[1]
content.text = "• Athlete's foot, ringworm, candidiasis\n• Poor drug penetration into skin\n• Current creams: greasy, poor spreadability\n• Need: Better delivery system"
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Why Emulgel?"
content = slide.placeholders[1]
content.text = "• Thixotropic (easy spread)\n• Controlled release\n• Greaseless\n• High drug loading\n• Stable (no phase separation)"
slide = prs.slides.add_slide(prs.slide_layouts[6]) # Blank
left = Inches(3)
top = Inches(2)
width = Inches(4)
height = Inches(2)
txBox = slide.shapes.add_textbox(left, top, width, height)
tf = txBox.text_frame
tf.text = "Thank You!\nQuestions?"
p = tf.paragraphs[0]
p.alignment = PP_ALIGN.CENTER
p.font.size = Pt(44)
p.font.bold = True
prs.save('Emulgel_Thesis_Presentation.pptx')
print("PPT created successfully: Emulgel_Thesis_Presentation.pptx")
from pptx import Presentation
from pptx.util import Inches, Pt
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Ondas Eletromagnéticas"
slide.placeholders[1].text = "Fundamentos e Aplicações\nFísica Geral"
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "O que são?"
tf = slide.shapes.placeholders[1].text_frame
tf.text = "São oscilações transversais de campos elétricos e magnéticos."
p = tf.add_paragraph()
p.text = "• Não precisam de meio material (propagam-se no vácuo)."
p = tf.add_paragraph()
p.text = "• Velocidade da luz: 300.000 km/s."
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "O Espectro Eletromagnético"
tf = slide.shapes.placeholders[1].text_frame
tf.text = "As ondas variam de acordo com a frequência:"
items = ["Ondas de Rádio", "Micro-ondas", "Infravermelho", "Luz Visível", "Ultravioleta", "Raios X", "Raios Gama"]
for item in items:
p = tf.add_paragraph()
p.text = f" - {item}"
prs.save('Apresentacao_Ondas.pptx')
from pptx import Presentation
from pptx.util import Inches, Pt
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Ondas Eletromagnéticas"
slide.placeholders[1].text = "Fundamentos e Aplicações\nFísica Geral"
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "O que são?"
tf = slide.shapes.placeholders[1].text_frame
tf.text = "São oscilações transversais de campos elétricos e magnéticos."
p = tf.add_paragraph()
p.text = "• Não precisam de meio material (propagam-se no vácuo)."
p = tf.add_paragraph()
p.text = "• Velocidade da luz: 300.000 km/s."
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "O Espectro Eletromagnético"
tf = slide.shapes.placeholders[1].text_frame
tf.text = "As ondas variam de acordo com a frequência:"
items = ["Ondas de Rádio", "Micro-ondas", "Infravermelho", "Luz Visível", "Ultravioleta", "Raios X", "Raios Gama"]
for item in items:
p = tf.add_paragraph()
p.text = f" - {item}"
prs.save('Apresentacao_Ondas.pptx')
``from pptx import Presentation
from pptx.util import Inches, Pt
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Ondas Eletromagnéticas"
slide.placeholders[1].text = "Fundamentos e Aplicações\nFísica Geral"
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "O que são?"
tf = slide.shapes.placeholders[1].text_frame
tf.text = "São oscilações transversais de campos elétricos e magnéticos."
p = tf.add_paragraph()
p.text = "• Não precisam de meio material (propagam-se no vácuo)."
p = tf.add_paragraph()
p.text = "• Velocidade da luz: 300.000 km/s."
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "O Espectro Eletromagnético"
tf = slide.shapes.placeholders[1].text_frame
tf.text = "As ondas variam de acordo com a frequência:"
items = ["Ondas de Rádio", "Micro-ondas", "Infravermelho", "Luz Visível", "Ultravioleta", "Raios X", "Raios Gama"]
for item in items:
p = tf.add_paragraph()
p.text = f" - {item}"
prs.save('Apresentacao_Ondas.pptx')
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
prs = Presentation()
prs.slide_width = Inches(13.33) # 16:9 widescreen
prs.slide_height = Inches(7.5)
blank_layout = prs.slide_layouts[6]
def set_bg(slide, r, g, b):
bg = slide.background
fill = bg.fill
fill.solid()
fill.fore_color.rgb = RGBColor(r, g, b)
slide1 = prs.slides.add_slide(blank_layout)
set_bg(slide1, 230, 245, 255) # Soft Sky Blue
tx_box1 = slide1.shapes.add_textbox(Inches(1.5), Inches(2.0), Inches(10.33), Inches(3.5))
tf1 = tx_box1.text_frame
p1 = tf1.paragraphs[0]
p1.text = "The Swing"
p1.font.size = Pt(64)
p1.font.bold = True
p1.font.color.rgb = RGBColor(24, 76, 120)
p1.alignment = PP_ALIGN.CENTER
p2 = tf1.add_paragraph()
p2.text = "By Robert Louis Stevenson\nGrade 2 English • Interactive Smart Board Lesson"
p2.font.size = Pt(28)
p2.font.color.rgb = RGBColor(80, 80, 80)
p2.alignment = PP_ALIGN.CENTER
slide2 = prs.slides.add_slide(blank_layout)
set_bg(slide2, 255, 253, 240) # Warm Light Yellow
title2 = slide2.shapes.add_textbox(Inches(1.0), Inches(0.6), Inches(11.33), Inches(1.0))
p_t2 = title2.text_frame.paragraphs[0]
p_t2.text = "Let's Read & Swing Together!"
p_t2.font.size = Pt(36)
p_t2.font.bold = True
p_t2.font.color.rgb = RGBColor(20, 80, 50)
poem_box = slide2.shapes.add_textbox(Inches(1.0), Inches(1.8), Inches(11.33), Inches(5.0))
tf2 = poem_box.text_frame
stanzas = [
"How do you like to go up in a swing,\nUp in the air so blue?\nOh, I do think it the pleasantest thing\nEver a child can do!",
"Up in the air and over the wall,\nTill I can see so wide,\nRivers and trees and cattle and all\nOver the countryside—",
"Till I look down on the garden green,\nDown on the roof so brown—\nUp in the air I go flying again,\nUp in the air and down!"
]
for stanza in stanzas:
p = tf2.add_paragraph()
p.text = stanza
p.font.size = Pt(20)
p.font.color.rgb = RGBColor(40, 40, 40)
p.space_after = Pt(14)
slide3 = prs.slides.add_slide(blank_layout)
set_bg(slide3, 245, 240, 255) # Light Lavender
title3 = slide3.shapes.add_textbox(Inches(1.0), Inches(0.6), Inches(11.33), Inches(1.0))
p_t3 = title3.text_frame.paragraphs[0]
p_t3.text = "Touch & Match: The Rhyme Challenge!"
p_t3.font.size = Pt(36)
p_t3.font.bold = True
p_t3.font.color.rgb = RGBColor(90, 40, 140)
col1 = slide3.shapes.add_textbox(Inches(2.0), Inches(2.2), Inches(4.0), Inches(4.5))
tf_c1 = col1.text_frame
for word in ["Swing", "Blue", "Wall", "Brown"]:
p = tf_c1.add_paragraph()
p.text = word
p.font.size = Pt(30)
p.font.bold = True
p.font.color.rgb = RGBColor(0, 102, 204)
p.space_after = Pt(24)
col2 = slide3.shapes.add_textbox(Inches(7.5), Inches(2.2), Inches(4.0), Inches(4.5))
tf_c2 = col2.text_frame
for target in ["Thing", "Do", "All", "Down"]:
p = tf_c2.add_paragraph()
p.text = f"➔ {target}"
p.font.size = Pt(30)
p.font.bold = True
p.font.color.rgb = RGBColor(204, 51, 0)
p.space_after = Pt(24)
slide4 = prs.slides.add_slide(blank_layout)
set_bg(slide4, 240, 255, 245) # Mint White
title4 = slide4.shapes.add_textbox(Inches(1.0), Inches(0.8), Inches(11.33), Inches(1.0))
p_t4 = title4.text_frame.paragraphs[0]
p_t4.text = "Colors & Home Mission"
p_t4.font.size = Pt(36)
p_t4.font.bold = True
p_t4.font.color.rgb = RGBColor(0, 120, 90)
body4 = slide4.shapes.add_textbox(Inches(1.5), Inches(2.2), Inches(10.33), Inches(4.5))
tf4 = body4.text_frame
items = [
"Colors from the Swing:",
" • Blue — Air / Sky",
" • Green — Garden",
" • Brown — Roof",
"",
"Home Mission:",
" 1. Draw a pretty swing tied to a big tree in your notebook.",
" 2. Write down your favorite rhyming pair below the drawing (e.g., Brown — Down)."
]
for item in items:
p = tf4.add_paragraph()
p.text = item
p.font.size = Pt(24)
p.font.color.rgb = RGBColor(50, 50, 50)
p.space_after = Pt(8)
prs.save("The_Swing_Microteaching.pptx")
print("Presentation generated successfully as 'The_Swing_Microteaching.pptx'")
from pptx import Presentation from pptx.util import Inches, Pt from pptx.dml.color import RGBColor
Create presentation
prs = Presentation()
Title Slide
title_slide_layout = prs.slide_layouts[0] slide = prs.slides.add_slide(title_slide_layout) title = slide.shapes.title title.text = "Iron Deficiency Anemia" subtitle = slide.placeholders[1] subtitle.text = "Lecture for MBBS Students"
Function to add a slide with bullet points
def add_bullet_slide(title_text, bullet_points): slide_layout = prs.slide_layouts[1] slide = prs.slides.add_slide(slide_layout) title = slide.shapes.title title.text = title_text content = slide.placeholders[1] tf = content.text_frame tf.clear() for point in bullet_points: p = tf.add_paragraph() p.text = point p.font.size = Pt(20)
Overview
add_bullet_slide("Overview", [ "Most common cause of anemia worldwide", "Microcytic, hypochromic red cells", "Common in children, women of reproductive age, elderly", "Hb <130 g/L (men), <120 g/L (women)" ])
Etiology
add_bullet_slide("Etiology", [ "Blood loss: GI bleeding, menorrhagia, NSAIDs", "Reduced intake: poor diet, vegetarian/vegan", "Malabsorption: celiac disease, gastrectomy", "Increased demand: pregnancy, growth spurts" ])
Clinical Features
add_bullet_slide("Clinical Features", [ "Symptoms: fatigue, dyspnoea, pica, headache", "Signs: pallor, angular cheilitis, koilonychia, glossitis", "Severe: tachycardia, murmurs, heart failure" ])
Pathophysiology
add_bullet_slide("Pathophysiology", [ "Loss of iron → reduced Hb synthesis", "Stages: 1) Depleted ferritin, 2) Impaired erythropoiesis, 3) Microcytosis & hypochromia", "Peripheral smear: microcytic, hypochromic, anisopoikilocytosis", "Bone marrow: absent iron stores (Prussian blue stain)" ])
Diagnosis
add_bullet_slide("Diagnosis", [ "CBC: low Hb, MCV, MCH, high RDW", "Iron studies: low ferritin, low transferrin saturation, high TIBC", "Peripheral smear: microcytic, hypochromic, elliptocytes", "Stages: ferritin ↓ → impaired erythropoiesis → microcytosis" ])
Management
add_bullet_slide("Management", [ "Treat underlying cause", "Oral iron: ferrous sulphate 200 mg/d × 3 months post-Hb