Make a ppt on it
mkdir -p /tmp/workspace/headache-ppt && ls /tmp/workspace/
~/headache-ppt/create_ppt.py
from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.util import Inches, Pt
from io import BytesIO
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
blank = prs.slide_layouts[6]
# ─── COLOR PALETTE ────────────────────────────────────────────────
RED = RGBColor(0xE3, 0x1E, 0x24) # accent red
DARK = RGBColor(0x1A, 0x1A, 0x2E) # navy dark bg
MID = RGBColor(0x16, 0x21, 0x3E) # slightly lighter navy
CARD = RGBColor(0x0F, 0x3C, 0x5C) # card bg
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
LIGHT = RGBColor(0xE0, 0xE7, 0xFF)
ACCENT = RGBColor(0xFF, 0xA0, 0xA0) # soft red
def add_rect(slide, left, top, width, height, fill_color, transparency=0):
shape = slide.shapes.add_shape(1, Inches(left), Inches(top), Inches(width), Inches(height))
shape.line.fill.background()
fill = shape.fill
fill.solid()
fill.fore_color.rgb = fill_color
return shape
def add_text(slide, text, left, top, width, height, font_size=18, bold=False,
color=WHITE, align=PP_ALIGN.LEFT, italic=False, wrap=True):
tb = slide.shapes.add_textbox(Inches(left), Inches(top), Inches(width), Inches(height))
tf = tb.text_frame
tf.word_wrap = wrap
p = tf.paragraphs[0]
p.alignment = align
run = p.add_run()
run.text = text
run.font.size = Pt(font_size)
run.font.bold = bold
run.font.italic = italic
run.font.color.rgb = color
return tb
# ══════════════════════════════════════════════════════════════════
# SLIDE 1 – TITLE SLIDE
# ══════════════════════════════════════════════════════════════════
slide1 = prs.slides.add_slide(blank)
add_rect(slide1, 0, 0, 13.333, 7.5, DARK) # bg
add_rect(slide1, 0, 0, 13.333, 0.08, RED) # top red stripe
add_rect(slide1, 0, 7.42, 13.333, 0.08, RED) # bottom red stripe
add_rect(slide1, 5.9, 1.5, 0.08, 4.5, RED) # vertical divider
# Left – head icon area (placeholder text symbol)
add_text(slide1, "🧠", 1.2, 1.8, 4, 1.5, font_size=80, align=PP_ALIGN.CENTER, color=RED)
# Right – title text
add_text(slide1, "HEADACHES ON THE", 6.3, 1.7, 6.5, 1, font_size=34, bold=True, color=WHITE)
add_text(slide1, "TOP OF THE HEAD", 6.3, 2.55, 6.5, 1, font_size=34, bold=True, color=RED)
add_text(slide1, "Understanding Tension-Type Headaches", 6.3, 3.55, 6.5, 0.6, font_size=16, italic=True, color=LIGHT)
add_text(slide1, "Causes • Symptoms • Treatment • Prevention", 6.3, 4.3, 6.5, 0.6, font_size=13, color=ACCENT)
add_text(slide1, "Medical Health Series", 0, 7.0, 13.333, 0.4, font_size=11,
color=LIGHT, align=PP_ALIGN.CENTER, italic=True)
# ══════════════════════════════════════════════════════════════════
# SLIDE 2 – OVERVIEW / WHAT IS IT?
# ══════════════════════════════════════════════════════════════════
slide2 = prs.slides.add_slide(blank)
add_rect(slide2, 0, 0, 13.333, 7.5, DARK)
add_rect(slide2, 0, 0, 13.333, 1.1, MID)
add_rect(slide2, 0, 1.1, 0.08, 6.4, RED)
add_text(slide2, "WHAT IS A TOP-OF-HEAD HEADACHE?", 0.3, 0.2, 12, 0.75,
font_size=26, bold=True, color=WHITE)
# Description box
add_rect(slide2, 0.4, 1.4, 12.5, 2.3, CARD)
add_text(slide2, (
"Headaches that occur on the top of the head are most commonly caused by tension-type headaches — "
"the most prevalent headache disorder worldwide. They are characterised by a dull, pressing or tightening "
"sensation around the head, often described as a band or cap squeezing the skull."
), 0.6, 1.55, 12.1, 2.0, font_size=15, color=WHITE, wrap=True)
# Three fact cards
card_data = [
("😣", "Dull Pain", "A steady, non-throbbing ache on the crown or across the whole head."),
("⚡", "Tightness", "Constant pressure or squeezing sensation like a tight band around the head."),
("📊", "Most Common", "Tension headaches account for ~90% of all headache episodes in adults."),
]
for i, (icon, title, desc) in enumerate(card_data):
x = 0.4 + i * 4.3
add_rect(slide2, x, 4.0, 4.0, 2.9, CARD)
add_text(slide2, icon, x + 0.1, 4.05, 1.0, 0.7, font_size=28, color=WHITE)
add_text(slide2, title, x + 0.15, 4.75, 3.7, 0.5, font_size=15, bold=True, color=RED)
add_text(slide2, desc, x + 0.15, 5.3, 3.7, 1.5, font_size=12, color=LIGHT, wrap=True)
add_text(slide2, "2", 12.9, 7.1, 0.4, 0.35, font_size=11, color=LIGHT, align=PP_ALIGN.RIGHT)
# ══════════════════════════════════════════════════════════════════
# SLIDE 3 – TRIGGERS & CAUSES
# ══════════════════════════════════════════════════════════════════
slide3 = prs.slides.add_slide(blank)
add_rect(slide3, 0, 0, 13.333, 7.5, DARK)
add_rect(slide3, 0, 0, 13.333, 1.1, MID)
add_rect(slide3, 0, 1.1, 0.08, 6.4, RED)
add_text(slide3, "COMMON TRIGGERS & CAUSES", 0.3, 0.2, 12, 0.75,
font_size=26, bold=True, color=WHITE)
triggers = [
("🍔", "Change in Diet", "Skipping meals, dehydration, excess caffeine or alcohol intake can all provoke tension headaches."),
("😴", "Poor Sleep Habits", "Insufficient sleep, irregular schedules, or oversleeping disrupts pain-threshold regulation."),
("🏃", "Change in Activity", "A sudden increase or decrease in physical activity alters muscle tension and blood flow."),
("😰", "Stress", "Emotional or mental stress is the #1 trigger — causes muscle tension in the scalp & neck."),
("🖥️", "Eye Strain / Posture", "Long screen time, poor posture, or hunching over a desk tightens neck and shoulder muscles."),
("🌦️", "Environmental Factors","Bright lights, loud noise, strong smells, or sudden weather changes can act as triggers."),
]
for i, (icon, title, desc) in enumerate(triggers):
row = i // 3
col = i % 3
x = 0.35 + col * 4.3
y = 1.3 + row * 2.9
add_rect(slide3, x, y, 4.1, 2.7, CARD)
add_text(slide3, icon, x + 0.12, y + 0.08, 0.8, 0.55, font_size=26, color=WHITE)
add_text(slide3, title, x + 0.15, y + 0.62, 3.8, 0.45, font_size=14, bold=True, color=RED)
add_text(slide3, desc, x + 0.15, y + 1.1, 3.8, 1.45, font_size=11, color=LIGHT, wrap=True)
add_text(slide3, "3", 12.9, 7.1, 0.4, 0.35, font_size=11, color=LIGHT, align=PP_ALIGN.RIGHT)
# ══════════════════════════════════════════════════════════════════
# SLIDE 4 – SYMPTOMS
# ══════════════════════════════════════════════════════════════════
slide4 = prs.slides.add_slide(blank)
add_rect(slide4, 0, 0, 13.333, 7.5, DARK)
add_rect(slide4, 0, 0, 13.333, 1.1, MID)
add_rect(slide4, 0, 1.1, 0.08, 6.4, RED)
add_text(slide4, "SIGNS & SYMPTOMS", 0.3, 0.2, 12, 0.75,
font_size=26, bold=True, color=WHITE)
symptoms = [
("Dull, aching head pain on the top or all over the head"),
("Sensation of tightness or pressure across the forehead or sides"),
("Tenderness in the scalp, neck, and shoulder muscles"),
("No nausea or vomiting (unlike migraines)"),
("Mild-to-moderate intensity — rarely severe"),
("Can last from 30 minutes to several hours, occasionally days"),
("Not aggravated by routine physical activity"),
("Possible sensitivity to light or sound (but not both simultaneously)"),
]
for i, s in enumerate(symptoms):
row = i // 2
col = i % 2
x = 0.4 + col * 6.4
y = 1.3 + row * 1.4
add_rect(slide4, x, y, 6.1, 1.2, CARD)
add_rect(slide4, x, y, 0.18, 1.2, RED) # left red stripe on card
add_text(slide4, s, x + 0.3, y + 0.2, 5.7, 0.9, font_size=13, color=WHITE, wrap=True)
add_text(slide4, "4", 12.9, 7.1, 0.4, 0.35, font_size=11, color=LIGHT, align=PP_ALIGN.RIGHT)
# ══════════════════════════════════════════════════════════════════
# SLIDE 5 – DIAGNOSIS
# ══════════════════════════════════════════════════════════════════
slide5 = prs.slides.add_slide(blank)
add_rect(slide5, 0, 0, 13.333, 7.5, DARK)
add_rect(slide5, 0, 0, 13.333, 1.1, MID)
add_rect(slide5, 0, 1.1, 0.08, 6.4, RED)
add_text(slide5, "HOW IS IT DIAGNOSED?", 0.3, 0.2, 12, 0.75,
font_size=26, bold=True, color=WHITE)
add_rect(slide5, 0.4, 1.25, 12.5, 1.7, CARD)
add_text(slide5, (
"Diagnosis is primarily clinical — based on history and physical examination. "
"Imaging (MRI/CT) is only required if red-flag features such as sudden onset, neurological deficits, "
"fever, or progressively worsening pattern are present."
), 0.6, 1.35, 12.1, 1.5, font_size=14, color=WHITE, wrap=True)
steps = [
("1", "Medical History", "Duration, frequency, intensity, location, triggers, family history."),
("2", "Physical Exam", "Neurological assessment, palpation of scalp & neck muscles."),
("3", "Headache Diary", "Patient tracks episodes, duration, triggers and relief measures."),
("4", "Rule-Out Tests", "CT/MRI only if red flags — sudden severe onset, vision change, weakness."),
]
for i, (num, title, desc) in enumerate(steps):
x = 0.4 + i * 3.2
add_rect(slide5, x, 3.2, 3.0, 3.7, CARD)
# number circle
add_rect(slide5, x + 0.9, 3.35, 1.2, 0.9, RED)
add_text(slide5, num, x + 0.9, 3.35, 1.2, 0.9, font_size=22, bold=True,
color=WHITE, align=PP_ALIGN.CENTER)
add_text(slide5, title, x + 0.1, 4.35, 2.8, 0.5, font_size=14, bold=True,
color=RED, align=PP_ALIGN.CENTER)
add_text(slide5, desc, x + 0.1, 4.9, 2.8, 1.9, font_size=11, color=LIGHT,
align=PP_ALIGN.CENTER, wrap=True)
add_text(slide5, "5", 12.9, 7.1, 0.4, 0.35, font_size=11, color=LIGHT, align=PP_ALIGN.RIGHT)
# ══════════════════════════════════════════════════════════════════
# SLIDE 6 – TREATMENT
# ══════════════════════════════════════════════════════════════════
slide6 = prs.slides.add_slide(blank)
add_rect(slide6, 0, 0, 13.333, 7.5, DARK)
add_rect(slide6, 0, 0, 13.333, 1.1, MID)
add_rect(slide6, 0, 1.1, 0.08, 6.4, RED)
add_text(slide6, "TREATMENT OPTIONS", 0.3, 0.2, 12, 0.75,
font_size=26, bold=True, color=WHITE)
# Two columns
add_rect(slide6, 0.4, 1.25, 6.0, 5.8, CARD)
add_text(slide6, "💊 Pharmacological", 0.6, 1.35, 5.6, 0.55, font_size=16, bold=True, color=RED)
pharma = [
"• OTC analgesics: Paracetamol (acetaminophen)",
"• NSAIDs: Ibuprofen, Aspirin, Naproxen",
"• Combination analgesics (caffeine-containing)",
"• Avoid overuse (>10 days/month → medication-overuse headache)",
"• Preventive: Amitriptyline, Mirtazapine for chronic TTH",
]
for j, line in enumerate(pharma):
add_text(slide6, line, 0.65, 2.0 + j * 0.9, 5.5, 0.8, font_size=13, color=WHITE, wrap=True)
add_rect(slide6, 6.9, 1.25, 6.0, 5.8, CARD)
add_text(slide6, "🌿 Non-Pharmacological", 7.1, 1.35, 5.6, 0.55, font_size=16, bold=True, color=RED)
nonpharma = [
"• Stress management: relaxation, breathing techniques",
"• Regular sleep schedule (7–9 hours/night)",
"• Biofeedback & cognitive behavioural therapy",
"• Physical therapy: stretching neck & shoulder muscles",
"• Applying warm/cold compress to the head or neck",
]
for j, line in enumerate(nonpharma):
add_text(slide6, line, 7.15, 2.0 + j * 0.9, 5.5, 0.8, font_size=13, color=WHITE, wrap=True)
add_text(slide6, "6", 12.9, 7.1, 0.4, 0.35, font_size=11, color=LIGHT, align=PP_ALIGN.RIGHT)
# ══════════════════════════════════════════════════════════════════
# SLIDE 7 – PREVENTION
# ══════════════════════════════════════════════════════════════════
slide7 = prs.slides.add_slide(blank)
add_rect(slide7, 0, 0, 13.333, 7.5, DARK)
add_rect(slide7, 0, 0, 13.333, 1.1, MID)
add_rect(slide7, 0, 1.1, 0.08, 6.4, RED)
add_text(slide7, "PREVENTION TIPS", 0.3, 0.2, 12, 0.75,
font_size=26, bold=True, color=WHITE)
tips = [
("🥗", "Balanced Diet", "Eat regular, nutritious meals. Avoid skipping meals and limit caffeine intake."),
("💧", "Stay Hydrated", "Drink 8+ glasses of water daily. Dehydration is a very common, easily avoidable trigger."),
("🛏️", "Good Sleep Hygiene", "Maintain consistent sleep and wake times. Avoid screens 1 hour before bedtime."),
("🧘", "Stress Reduction", "Practice yoga, meditation, or progressive muscle relaxation daily."),
("🏃", "Regular Exercise", "Moderate aerobic exercise 3–4 times/week improves circulation and reduces stress hormones."),
("📱", "Limit Screen Time", "Follow 20-20-20 rule: every 20 min, look at something 20 ft away for 20 seconds."),
]
for i, (icon, title, desc) in enumerate(tips):
row = i // 3
col = i % 3
x = 0.35 + col * 4.3
y = 1.3 + row * 2.85
add_rect(slide7, x, y, 4.1, 2.65, CARD)
add_rect(slide7, x, y, 4.1, 0.55, RED) # red header strip
add_text(slide7, icon + " " + title, x + 0.12, y + 0.05, 3.85, 0.48,
font_size=14, bold=True, color=WHITE)
add_text(slide7, desc, x + 0.15, y + 0.7, 3.8, 1.8, font_size=12, color=LIGHT, wrap=True)
add_text(slide7, "7", 12.9, 7.1, 0.4, 0.35, font_size=11, color=LIGHT, align=PP_ALIGN.RIGHT)
# ══════════════════════════════════════════════════════════════════
# SLIDE 8 – WHEN TO SEE A DOCTOR
# ══════════════════════════════════════════════════════════════════
slide8 = prs.slides.add_slide(blank)
add_rect(slide8, 0, 0, 13.333, 7.5, DARK)
add_rect(slide8, 0, 0, 13.333, 1.1, MID)
add_rect(slide8, 0, 1.1, 0.08, 6.4, RED)
add_text(slide8, "WHEN TO SEE A DOCTOR", 0.3, 0.2, 12, 0.75,
font_size=26, bold=True, color=WHITE)
add_rect(slide8, 0.4, 1.25, 12.5, 1.3, CARD)
add_text(slide8, (
"Most tension headaches are benign and resolve with self-care. However, some symptoms signal "
"a more serious underlying condition requiring immediate medical evaluation."
), 0.6, 1.35, 12.1, 1.1, font_size=14, color=WHITE, wrap=True)
red_flags = [
("🚨", "Thunderclap Headache", "Sudden, extremely severe headache — 'worst of life' onset. Possible subarachnoid haemorrhage."),
("🧠", "Neurological Symptoms", "Confusion, vision loss, slurred speech, weakness/numbness in limbs."),
("🌡️", "Fever + Stiff Neck", "Combination may indicate meningitis or encephalitis — seek emergency care."),
("📈", "Progressive Worsening", "Headache that steadily worsens over days/weeks with no relief."),
("💊", "Medication Overuse", "Using painkillers >10 days/month — can cause rebound headaches."),
("🔄", "Frequent Episodes", "Headaches occurring 15+ days/month for 3+ months suggest chronic daily headache."),
]
for i, (icon, title, desc) in enumerate(red_flags):
row = i // 2
col = i % 2
x = 0.4 + col * 6.4
y = 2.75 + row * 1.5
add_rect(slide8, x, y, 6.1, 1.3, CARD)
add_rect(slide8, x, y, 0.18, 1.3, RED)
add_text(slide8, icon + " " + title, x + 0.35, y + 0.08, 5.6, 0.45, font_size=13, bold=True, color=ACCENT)
add_text(slide8, desc, x + 0.35, y + 0.52, 5.6, 0.7, font_size=11, color=WHITE, wrap=True)
add_text(slide8, "8", 12.9, 7.1, 0.4, 0.35, font_size=11, color=LIGHT, align=PP_ALIGN.RIGHT)
# ══════════════════════════════════════════════════════════════════
# SLIDE 9 – SUMMARY / CLOSING
# ══════════════════════════════════════════════════════════════════
slide9 = prs.slides.add_slide(blank)
add_rect(slide9, 0, 0, 13.333, 7.5, DARK)
add_rect(slide9, 0, 0, 13.333, 0.08, RED)
add_rect(slide9, 0, 7.42, 13.333, 0.08, RED)
add_text(slide9, "KEY TAKEAWAYS", 0, 0.6, 13.333, 0.8,
font_size=30, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_rect(slide9, 4.5, 1.4, 4.333, 0.07, RED) # underline
takeaways = [
"Top-of-head headaches are most often tension-type — the most common headache globally.",
"Key triggers include stress, poor sleep, dietary changes, and altered activity levels.",
"Symptoms: dull, pressing pain; tightness; scalp tenderness — no nausea or aura.",
"Diagnosis is clinical; imaging only if red-flag features are present.",
"Treated with OTC analgesics, relaxation, sleep hygiene, and physiotherapy.",
"Prevention: hydration, regular meals, stress management, and exercise.",
"Seek medical care for sudden severe onset, neurological features, or fever.",
]
for i, t in enumerate(takeaways):
add_rect(slide9, 1.2, 1.75 + i * 0.73, 10.9, 0.65, CARD)
add_rect(slide9, 1.2, 1.75 + i * 0.73, 0.2, 0.65, RED)
add_text(slide9, t, 1.55, 1.82 + i * 0.73, 10.5, 0.55, font_size=13, color=WHITE, wrap=True)
add_text(slide9, "Consult a healthcare professional for persistent or unusual headaches.",
0, 7.05, 13.333, 0.38, font_size=12, italic=True, color=ACCENT, align=PP_ALIGN.CENTER)
# ─── SAVE ──────────────────────────────────────────────────────────
out = "/tmp/workspace/headache-ppt/Headaches_on_Top_of_Head.pptx"
buf = BytesIO()
prs.save(buf)
with open(out, "wb") as f:
f.write(buf.getvalue())
print("Saved:", out)
python /tmp/workspace/headache-ppt/create_ppt.py
| Slide | Content |
|---|---|
| 1 | Title slide |
| 2 | What is a top-of-head headache? (overview + 3 fact cards) |
| 3 | Common triggers & causes (6 cards: diet, sleep, activity, stress, posture, environment) |
| 4 | Signs & symptoms (8-point grid) |
| 5 | How is it diagnosed? (4-step process) |
| 6 | Treatment - pharmacological vs non-pharmacological (side-by-side) |
| 7 | Prevention tips (6 illustrated cards) |
| 8 | When to see a doctor (red-flag warning signs) |
| 9 | Key takeaways summary |
Headaches on Top of Head
Presentation · PPTX