Make an hand written of this including all topics and covering each and every points
ls /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/game…
~/gametogenesis-notes/generate_notes.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, HRFlowable, Table, TableStyle
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm, inch
from reportlab.platypus import Flowable
from reportlab.pdfgen import canvas
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
import os
OUTPUT = "/home/daytona/workspace/gametogenesis-notes/Gametogenesis_Notes.pdf"
# ── Page setup ──────────────────────────────────────────────────────────────
PAGE_W, PAGE_H = A4 # 595.27 x 841.89 pt
LEFT_MARGIN = 22 * mm
RIGHT_MARGIN = 15 * mm
TOP_MARGIN = 18 * mm
BOT_MARGIN = 18 * mm
# ── Handwriting-style fonts (bundled with reportlab) ────────────────────────
# We'll simulate handwriting look using Helvetica + careful styling
# Colors that mimic pen colors
BLUE_PEN = colors.HexColor('#1a1aff') # blue ballpoint
PURPLE_PEN = colors.HexColor('#6600cc') # purple/violet for headings
GREEN_PEN = colors.HexColor('#006600') # green for sub-points
RED_PEN = colors.HexColor('#cc0000') # red for labels
BLACK_PEN = colors.HexColor('#111111') # black pen
PINK_HEAD = colors.HexColor('#cc0066') # pink/magenta for main headings
# ── Line background – ruled notebook ────────────────────────────────────────
LINE_COLOR = colors.HexColor('#c8d8f0') # faint blue lines
MARGIN_RED = colors.HexColor('#e87070') # red margin line
class NotebookPage(canvas.Canvas):
"""Draws ruled lines + red margin on each page."""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._saved_page_states = []
def showPage(self):
self._saved_page_states.append(dict(self.__dict__))
self._startPage()
def save(self):
num_pages = len(self._saved_page_states)
for state in self._saved_page_states:
self.__dict__.update(state)
self._draw_notebook_lines()
canvas.Canvas.showPage(self)
canvas.Canvas.save(self)
def _draw_notebook_lines(self):
self.saveState()
# Ruled horizontal lines
self.setStrokeColor(LINE_COLOR)
self.setLineWidth(0.4)
line_spacing = 7.5 * mm
y = PAGE_H - TOP_MARGIN - 5
while y > BOT_MARGIN:
self.line(LEFT_MARGIN - 5, y, PAGE_W - RIGHT_MARGIN + 5, y)
y -= line_spacing
# Red margin vertical line
self.setStrokeColor(MARGIN_RED)
self.setLineWidth(1.0)
self.line(LEFT_MARGIN - 2, PAGE_H - 8, LEFT_MARGIN - 2, BOT_MARGIN)
# Page border
self.setStrokeColor(colors.HexColor('#dddddd'))
self.setLineWidth(0.5)
self.rect(10, 10, PAGE_W - 20, PAGE_H - 20, fill=0)
self.restoreState()
def build_pdf():
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=LEFT_MARGIN,
rightMargin=RIGHT_MARGIN,
topMargin=TOP_MARGIN,
bottomMargin=BOT_MARGIN,
)
styles = getSampleStyleSheet()
def S(name, parent='Normal', **kw):
return ParagraphStyle(name, parent=styles[parent], **kw)
# ── Define styles ────────────────────────────────────────────────────────
title_style = S('MainTitle',
fontName='Helvetica-BoldOblique',
fontSize=22,
textColor=PINK_HEAD,
alignment=TA_CENTER,
spaceAfter=6,
leading=28,
)
heading1 = S('H1',
fontName='Helvetica-BoldOblique',
fontSize=16,
textColor=PURPLE_PEN,
spaceBefore=10,
spaceAfter=4,
leading=22,
)
heading2 = S('H2',
fontName='Helvetica-BoldOblique',
fontSize=13,
textColor=PINK_HEAD,
spaceBefore=8,
spaceAfter=3,
leading=18,
)
label_style = S('Label',
fontName='Helvetica-Bold',
fontSize=11,
textColor=RED_PEN,
spaceBefore=5,
spaceAfter=2,
leading=15,
)
body_blue = S('BodyBlue',
fontName='Helvetica',
fontSize=11,
textColor=BLUE_PEN,
leading=16,
spaceAfter=2,
leftIndent=6,
)
body_black = S('BodyBlack',
fontName='Helvetica',
fontSize=11,
textColor=BLACK_PEN,
leading=16,
spaceAfter=2,
leftIndent=6,
)
body_green = S('BodyGreen',
fontName='Helvetica',
fontSize=11,
textColor=GREEN_PEN,
leading=16,
spaceAfter=2,
leftIndent=6,
)
bullet_blue = S('BulletBlue',
fontName='Helvetica',
fontSize=11,
textColor=BLUE_PEN,
leading=16,
spaceAfter=2,
leftIndent=14,
bulletIndent=4,
)
bullet_black = S('BulletBlack',
fontName='Helvetica',
fontSize=11,
textColor=BLACK_PEN,
leading=16,
spaceAfter=2,
leftIndent=14,
bulletIndent=4,
)
flow_style = S('Flow',
fontName='Helvetica-Oblique',
fontSize=11,
textColor=BLACK_PEN,
leading=16,
alignment=TA_CENTER,
spaceAfter=2,
)
arrow_style = S('Arrow',
fontName='Helvetica-Bold',
fontSize=13,
textColor=PURPLE_PEN,
alignment=TA_CENTER,
spaceAfter=2,
)
note_style = S('Note',
fontName='Helvetica-Oblique',
fontSize=10,
textColor=colors.HexColor('#555555'),
leading=14,
leftIndent=14,
)
caps_style = S('Caps',
fontName='Helvetica-Bold',
fontSize=11,
textColor=RED_PEN,
leading=16,
alignment=TA_CENTER,
)
sub_label = S('SubLabel',
fontName='Helvetica-BoldOblique',
fontSize=11,
textColor=PINK_HEAD,
spaceBefore=6,
spaceAfter=2,
leading=15,
)
def HR():
return HRFlowable(width='100%', thickness=0.5, color=LINE_COLOR, spaceAfter=4, spaceBefore=4)
def SP(h=4):
return Spacer(1, h)
story = []
# ════════════════════════════════════════════════════════════════════════
# PAGE 1 — GAMETOGENESIS + OOGENESIS
# ════════════════════════════════════════════════════════════════════════
story.append(Paragraph("Gametogenesis", title_style))
story.append(HR())
story.append(Paragraph(
"The process involved in maturation of two highly specialized cells — "
"spermatozoon in male & ovum in female — before they unite to form a <b>zygote</b>.",
body_blue))
story.append(SP(10))
# OOGENESIS heading
story.append(Paragraph("⇒ Oogenesis", heading1))
story.append(Paragraph("<b>def<sup>n</sup>:</b> Process involved in the development of mature ovum.", body_blue))
story.append(SP(6))
story.append(Paragraph("Process :-", label_style))
oogenesis_steps = [
"1. Primitive germ cell take origin from <b>YOLK SAC</b> about end of 3<sup>rd</sup> week & migrate to <b>gonadal ridge</b> about end of 4<sup>th</sup> week.",
"2. In female gonads (ovary), germ cell undergo mitotic division & differentiate into <b>oogonia</b>.",
"3. At 20<sup>th</sup> week, about <b>7 million oogonia</b>.",
"4. Oogonia continue to divide & form <b>Primary oocyte</b>. These surrounded by flat cells & k/a <b>primordial follicles</b> present in cortex of ovary.",
"5. At birth: <b>NO MORE MITOTIC DIVISION</b> & all oogonia replaced by primary oocyte — remain in <b>resting phase (dictyotene stage)</b> b/w prophase and metaphase.",
"6. Total no of oocyte at birth is about <b>2 million</b>.",
"7. Primary oocyte do <b>not</b> finish division until puberty.",
"8. At puberty, <b>4,00,000 oocyte</b> left behind; rest being atretic — <b>400</b> are likely to ovulate during reproductive period.",
]
for step in oogenesis_steps:
story.append(Paragraph(step, body_black))
story.append(SP(3))
story.append(SP(8))
story.append(HR())
# MATURATION flowchart
story.append(Paragraph("Maturation :-", label_style))
flow_items = [
("Germ cells", False),
("↓ mitosis", True),
("Oogonia", False),
("↓", True),
("Primary oocyte (46, XX)", False),
("↓", True),
("Arrested first meiotic division (upto puberty)", False),
("↓", True),
("Maturation of Graafian follicle", False),
("↓ (completion of 1st meiotic div)", True),
("OVULATION", False),
]
for text, is_arrow in flow_items:
style = arrow_style if is_arrow else flow_style
if text == "OVULATION":
story.append(Paragraph(f'<font color="#cc0066"><b>{text}</b></font>', caps_style))
else:
story.append(Paragraph(text, style))
story.append(SP(6))
# Two branches after ovulation
data = [
[Paragraph("<b><u>Not Fertilized</u></b>", body_black),
Paragraph("<b><u>Fertilized</u></b>", body_black)],
[Paragraph("↓", arrow_style),
Paragraph("↓", arrow_style)],
[Paragraph("Degeneration within 24 hrs", body_black),
Paragraph("Completion of 2<sup>nd</sup> meiotic div", body_black)],
[Paragraph("↓", arrow_style),
Paragraph("↓", arrow_style)],
[Paragraph("—", body_black),
Paragraph("Female pronucleus (23, X) + 2<sup>nd</sup> polar body (23, X)", body_black)],
]
t = Table(data, colWidths=[doc.width / 2 - 5, doc.width / 2 - 5])
t.setStyle(TableStyle([
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LINEAFTER', (0, 0), (0, -1), 0.5, colors.HexColor('#aaaaaa')),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
]))
story.append(t)
story.append(SP(12))
# ════════════════════════════════════════════════════════════════════════
# OVULATION
# ════════════════════════════════════════════════════════════════════════
story.append(HR())
story.append(Paragraph("⇒ Ovulation", heading1))
story.append(Paragraph(
"<b>def<sup>n</sup>:</b> Process where a secondary oocyte is released from ovary "
"following rupture of mature Graafian follicle and becomes available for conception.",
body_blue))
story.append(SP(4))
ovul_facts = [
"• Starts at puberty; ends at menopause",
"• Occurs on 14<sup>th</sup> day of menstrual cycle",
"• Remains suspended during pregnancy and Lactation",
]
for f in ovul_facts:
story.append(Paragraph(f, body_black))
story.append(SP(8))
story.append(Paragraph("Mechanism :- Changes occur in both follicle and oocyte", sub_label))
story.append(Paragraph("<b>STEPS:</b>", label_style))
ovul_steps = [
"1. Movement of Graafian follicle to the ovary surface, & enlarges in size about <b>20 mm</b>.",
"2. <b>Cumulus oophorus</b> (cluster of granulosa cells) floats in antrum (cavity of follicle).",
"3. Follicular wall near ovarian surface becomes <b>thin</b>.",
"4. <b>Stigma</b> develops on surface of mature Graafian follicle just before ovulation.",
"5. Cumulus escapes out of follicle as a slow-oozing process taking about <b>1-2 mins</b> with large amount of follicular fluid ⇒ <b>Ovulation</b>.",
"6. Steg closed by plug of plasma. In oocyte — completion of arrested 1<sup>st</sup> meiotic division → 1<sup>st</sup> polar body + <b>Secondary oocyte</b>.",
]
for step in ovul_steps:
story.append(Paragraph(step, body_black))
story.append(SP(3))
story.append(SP(8))
story.append(Paragraph("Cause :-", sub_label))
cause_items = [
"Combined <b>LH / FSH midcycle surge</b> responsible for maturation, rupture & expulsion of oocyte.",
"⇒ <b>LH:</b> Sustained peak level of estrogen for 24-36 hrs causes <b>LH surge</b>.",
"⇒ <b>FSH:</b> Positive feedback of estrogen to induce FSH surge — causes increase in plasminogen activator & helps in lysis <b>(PLASMIN)</b>.",
]
for item in cause_items:
story.append(Paragraph(item, body_black))
story.append(SP(3))
story.append(SP(8))
story.append(Paragraph("Effect :-", sub_label))
effect_items = [
"• Following ovulation, change to <b>Corpus Luteum</b>",
"• Ovum into <b>Fallopian tube</b>",
"• Menstruation unrelated with ovulation",
"• Common in adolescence, and in women approaching menopause",
]
for e in effect_items:
story.append(Paragraph(e, body_black))
story.append(SP(2))
story.append(SP(10))
story.append(HR())
# ════════════════════════════════════════════════════════════════════════
# OVARIAN FOLLICLE DIAGRAM (text-based)
# ════════════════════════════════════════════════════════════════════════
story.append(Paragraph("Ovarian Follicle Structure (Labels)", sub_label))
diagram_labels = [
"• Ovarian stroma (outer layer)",
"• Theca externa",
"• Theca interna",
"• Oocyte (central)",
"• Antrum (fluid-filled cavity)",
"• Cumulus oophorus cells",
"• Oocyte in 2<sup>nd</sup> meiotic division",
]
for lbl in diagram_labels:
story.append(Paragraph(lbl, note_style))
story.append(SP(10))
# ════════════════════════════════════════════════════════════════════════
# SPERMATOGENESIS
# ════════════════════════════════════════════════════════════════════════
story.append(HR())
story.append(Paragraph("⇒ Spermatogenesis", heading1))
story.append(Paragraph(
"<b>def:</b> Process involved in development of spermatids from primordial germ cells "
"and their differentiation into spermatozoa.",
body_blue))
story.append(SP(6))
story.append(Paragraph("Process :-", label_style))
# Flowchart for spermatogenesis
sperm_flow = [
("Primordial germ cells", "STAGE 1: PROLIFERATION", PURPLE_PEN),
("↓ Mitosis", None, None),
("Spermatogonia (remain in wall of seminiferous tubules)", None, None),
("↓", None, None),
("Primary spermatocyte (46, XY) — about 16 days", "STAGE 2: GROWTH", PURPLE_PEN),
("(remain in stage of primary prophase)", None, None),
("↓", None, None),
("First meiotic division", None, None),
("↓", None, None),
("Secondary spermatocyte", "STAGE 3: MATURATION", PURPLE_PEN),
]
for text, stage, color in sperm_flow:
if stage:
row_data = [
Paragraph(text, flow_style),
Paragraph(f'<font color="#6600cc"><b>⊙ {stage}</b></font>',
ParagraphStyle('s', fontName='Helvetica-Bold', fontSize=10,
textColor=PURPLE_PEN, alignment=TA_LEFT))
]
t2 = Table([row_data], colWidths=[doc.width * 0.60, doc.width * 0.40])
t2.setStyle(TableStyle([('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 2),
('BOTTOMPADDING', (0,0), (-1,-1), 2)]))
story.append(t2)
else:
story.append(Paragraph(text, flow_style))
story.append(SP(2))
# Split into 23X and 23Y
story.append(SP(4))
data2 = [
[Paragraph("23, X", flow_style), Paragraph("23, Y", flow_style)],
[Paragraph("↓", arrow_style), Paragraph("↓", arrow_style)],
[Paragraph("<b>Second meiotic division</b>", flow_style), Paragraph("", flow_style)],
]
t3 = Table(data2, colWidths=[doc.width / 2 - 5, doc.width / 2 - 5])
t3.setStyle(TableStyle([
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('LINEAFTER', (0,0), (0,-1), 0.5, colors.HexColor('#aaaaaa')),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(t3)
story.append(SP(4))
# After 2nd meiotic division
chromo_data = [
[Paragraph("23, X", flow_style), Paragraph("23, X", flow_style),
Paragraph("23, Y", flow_style), Paragraph("23, Y", flow_style)],
]
t4 = Table(chromo_data, colWidths=[doc.width/4]*4)
t4.setStyle(TableStyle([
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING', (0,0), (-1,-1), 3),
('BOX', (0,0), (-1,-1), 0.5, colors.HexColor('#aaaaaa')),
]))
story.append(t4)
story.append(SP(4))
transform_items = [
"↓",
"Spermatids ⊙ TRANSFORMATION",
"↓ Spermiogenesis",
"Morphological change occurs to form Spermatozoa",
"↓",
"Mature spermatogonium (About 61 days)",
]
for item in transform_items:
if "TRANSFORMATION" in item or "Spermiogenesis" in item:
story.append(Paragraph(f"<b>{item}</b>", ParagraphStyle('t', fontName='Helvetica-Bold',
fontSize=11, textColor=PURPLE_PEN, alignment=TA_CENTER, leading=16)))
else:
story.append(Paragraph(item, flow_style))
story.append(SP(2))
story.append(SP(6))
story.append(Paragraph(
"<b>Spermiation</b> → process by which matured sperms are released from "
"<b>Sertoli cells</b> into the lumen.",
body_black))
story.append(SP(10))
story.append(HR())
# ════════════════════════════════════════════════════════════════════════
# SPERM CAPACITATION AND ACROSOME REACTION
# ════════════════════════════════════════════════════════════════════════
story.append(Paragraph("Sperm Capacitation and Acrosome Reaction :-", heading2))
cap_items = [
"• Physiochemical change in sperm by which it becomes <b>hypermotile</b> & is able to bind & fertilize secondary oocyte.",
"• Occurs in genital tract & takes about <b>2-6 hrs</b>.",
"• <b>Acrosome reaction</b> → Triggered when sperm bind to zona pellucida <b>(ZP3)</b>.",
"• Release of <b>hyaluronidase</b>, hydrolytic enzyme, proacrosin, acrosin help sperm to digest zona pellucida & enter oocyte.",
]
for item in cap_items:
story.append(Paragraph(item, body_black))
story.append(SP(3))
story.append(SP(6))
# Sperm diagram (text-based)
story.append(Paragraph("SPERM — Structure", sub_label))
sperm_parts = [
("Acrosome", "Tip of the head — contains hydrolytic enzymes"),
("Head", "Contains nucleus with genetic material"),
("Neck", "Narrow region connecting head to midpiece"),
("Midpiece", "Contains mitochondria (energy production)"),
("Mitochondria", "Coiled around axoneme in midpiece — ATP for motility"),
("Tail (Flagellum)", "Long whip-like structure for motility"),
("End piece", "Terminal tip of the tail"),
]
sperm_data = [[Paragraph(f"<b>{part}</b>", body_black),
Paragraph(desc, body_black)] for part, desc in sperm_parts]
t_sperm = Table(sperm_data, colWidths=[doc.width * 0.30, doc.width * 0.70])
t_sperm.setStyle(TableStyle([
('BACKGROUND', (0, 0), (0, -1), colors.HexColor('#f0f0ff')),
('LINEBELOW', (0, 0), (-1, -2), 0.3, LINE_COLOR),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 6),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
]))
story.append(t_sperm)
story.append(SP(10))
story.append(HR())
# ════════════════════════════════════════════════════════════════════════
# FERTILIZATION
# ════════════════════════════════════════════════════════════════════════
story.append(Paragraph("Fertilization", title_style))
story.append(HR())
story.append(Paragraph(
"<b>def:</b> Is the process of fusion of spermatozoon with mature ovum. "
"Occurs in <b>Ampullary part of Fallopian tube</b>.",
body_blue))
story.append(SP(5))
fert_facts = [
"• <b>Lifespan:</b> Ovum (oocyte) = <b>12-14 hrs</b>; Sperm = <b>48-72 hrs</b>",
"• Millions of sperms are ejaculated, but only <b>300-500 reach ovum</b>",
]
for f in fert_facts:
story.append(Paragraph(f, body_black))
story.append(SP(3))
story.append(SP(6))
story.append(Paragraph("Process: Contact and Fusion of Gametes", sub_label))
fert_steps = [
"1. Sperm release <b>hyaluronidase</b> from acrosome which dissolves <b>corona radiata</b> of ovum, allowing sperm to pass.",
"2. Sperm penetrates <b>zona pellucida</b> by acrosome reaction (enzymes) — many sperm can penetrate.",
"3. Only <b>one sperm</b> out of many touches & fuses with the <b>oolemma</b> (egg cell membrane).",
"4. After sperm fusion, penetration of other sperm is prevented by <b>zona reaction</b> (hardening) & <b>oolemma block</b>.",
"5. Completion of <b>Meiosis II</b> occurs — secondary oocyte completes second meiotic division. Forms: <b>Female pronucleus</b> + <b>Second polar body</b>.",
"6. <b>Formation of Pronuclei</b> — both the head and tail of sperm enter oocyte & sperm nucleus forms <b>male pronucleus</b>. The male & female pronuclei fuse to restore <b>46 chromosomes</b>, resulting in formation of <b>Zygote</b> (contains genetic material from both parents).",
"7. <b>Sex Determination:</b> by SPERM<br/>X sperm + X ovum → <b>XX (Female)</b><br/>Y sperm + X ovum → <b>XY (Male)</b>",
"8. <b>Cleavage</b> formation begins after fertilization.",
]
for step in fert_steps:
story.append(Paragraph(step, body_black))
story.append(SP(4))
story.append(SP(6))
# Fertilization diagram labels
story.append(Paragraph("Fertilization Diagram — Key Labels", sub_label))
fert_diag = [
"• Acrosome-intact sperm head (approaching)",
"• Fully acrosome-reacted sperm head (penetrating)",
"• Corona cells (granulosa cells around egg)",
"• Zona pellucida",
"• Perivitelline space",
"• Vesiculating sperm head within ooplasm",
"⇒ Fertilization (completed)",
]
for lbl in fert_diag:
story.append(Paragraph(lbl, note_style))
story.append(SP(2))
# ── Build with page canvas ────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
build_pdf()
cd /home/daytona/workspace/gametogenesis-notes && python generate_notes.py 2>&1
ls -lh /home/daytona/workspace/gametogenesis-notes/
python3 -c " from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttf…
# Download free handwriting font (Caveat) for authentic look cd /home/daytona/wo…
~/gametogenesis-notes/generate_handwritten.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, HRFlowable, Table, TableStyle, PageBreak
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm
from reportlab.pdfgen import canvas as pdfcanvas
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.lib.enums import TA_CENTER, TA_LEFT
import os
# Register handwriting fonts
BASE = "/home/daytona/workspace/gametogenesis-notes/"
pdfmetrics.registerFont(TTFont('Caveat', BASE + 'Caveat-Regular.ttf'))
pdfmetrics.registerFont(TTFont('CaveatBold', BASE + 'Caveat-Bold.ttf'))
OUTPUT = BASE + "Gametogenesis_Handwritten_Notes.pdf"
PAGE_W, PAGE_H = A4
LEFT = 22 * mm
RIGHT = 14 * mm
TOP = 20 * mm
BOT = 16 * mm
# Pen colors
BLUE = colors.HexColor('#1a1aff')
PURPLE = colors.HexColor('#6600cc')
PINK = colors.HexColor('#cc0066')
GREEN = colors.HexColor('#006600')
BLACK = colors.HexColor('#111111')
RED = colors.HexColor('#cc0000')
TEAL = colors.HexColor('#007b7b')
LINE_C = colors.HexColor('#b8cfe8')
MARGIN = colors.HexColor('#e07070')
PAPERBG= colors.HexColor('#fdfaf4') # warm off-white paper
# ── Notebook-ruled canvas ──────────────────────────────────────────────────
class RuledCanvas:
def __init__(self, filename, pagesize, **kw):
self.c = pdfcanvas.Canvas(filename, pagesize=pagesize)
self._pages = []
self._pw, self._ph = pagesize
def _draw_rules(self):
c = self.c
c.saveState()
# Paper background
c.setFillColor(PAPERBG)
c.rect(0, 0, self._pw, self._ph, fill=1, stroke=0)
# Horizontal ruled lines
c.setStrokeColor(LINE_C)
c.setLineWidth(0.35)
ls = 8.0 * mm
y = self._ph - TOP + 2
while y > BOT - 4:
c.line(LEFT - 6, y, self._pw - RIGHT + 6, y)
y -= ls
# Red margin
c.setStrokeColor(MARGIN)
c.setLineWidth(0.9)
c.line(LEFT - 3, self._ph - 10, LEFT - 3, BOT)
# Outer border
c.setStrokeColor(colors.HexColor('#cccccc'))
c.setLineWidth(0.4)
c.rect(8, 8, self._pw - 16, self._ph - 16, fill=0)
c.restoreState()
def beforePage(self):
self._draw_rules()
def afterPage(self):
pass
class NoteDocTemplate(SimpleDocTemplate):
def handle_pageBegin(self):
self.canv.saveState()
# Paper bg
self.canv.setFillColor(PAPERBG)
self.canv.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
# Ruled lines
self.canv.setStrokeColor(LINE_C)
self.canv.setLineWidth(0.35)
ls = 8.0 * mm
y = PAGE_H - TOP + 2
while y > BOT - 4:
self.canv.line(LEFT - 6, y, PAGE_W - RIGHT + 6, y)
y -= ls
# Red margin
self.canv.setStrokeColor(MARGIN)
self.canv.setLineWidth(0.9)
self.canv.line(LEFT - 3, PAGE_H - 10, LEFT - 3, BOT)
# Border
self.canv.setStrokeColor(colors.HexColor('#cccccc'))
self.canv.setLineWidth(0.4)
self.canv.rect(8, 8, PAGE_W - 16, PAGE_H - 16, fill=0)
self.canv.restoreState()
super().handle_pageBegin()
def build():
doc = NoteDocTemplate(
OUTPUT, pagesize=A4,
leftMargin=LEFT, rightMargin=RIGHT,
topMargin=TOP, bottomMargin=BOT,
)
# ── Style helpers ─────────────────────────────────────────────────────
def S(name, font='Caveat', size=14, color=BLACK, align=TA_LEFT,
spaceBefore=4, spaceAfter=2, leading=None, indent=0, boldIndent=0):
return ParagraphStyle(
name,
fontName=font,
fontSize=size,
textColor=color,
alignment=align,
spaceBefore=spaceBefore,
spaceAfter=spaceAfter,
leading=leading or (size * 1.45),
leftIndent=indent,
bulletIndent=boldIndent,
)
main_title = S('MT', font='CaveatBold', size=26, color=PINK, align=TA_CENTER, spaceBefore=2, spaceAfter=6)
h1 = S('H1', font='CaveatBold', size=20, color=PURPLE, spaceBefore=10, spaceAfter=4)
h2 = S('H2', font='CaveatBold', size=16, color=PINK, spaceBefore=8, spaceAfter=3)
def_lbl = S('DL', font='CaveatBold', size=14, color=GREEN, spaceBefore=4, spaceAfter=2)
proc_lbl = S('PL', font='CaveatBold', size=14, color=PINK, spaceBefore=6, spaceAfter=2)
body_b = S('BB', font='Caveat', size=14, color=BLUE, spaceBefore=1, spaceAfter=1, indent=4)
body_k = S('BK', font='Caveat', size=14, color=BLACK, spaceBefore=1, spaceAfter=1, indent=4)
body_g = S('BG', font='Caveat', size=14, color=GREEN, spaceBefore=1, spaceAfter=1, indent=4)
body_r = S('BR', font='Caveat', size=14, color=RED, spaceBefore=1, spaceAfter=1, indent=4)
flow_c = S('FC', font='Caveat', size=14, color=BLACK, align=TA_CENTER, spaceBefore=1, spaceAfter=1)
flow_bold = S('FB', font='CaveatBold', size=14, color=PURPLE, align=TA_CENTER, spaceBefore=1, spaceAfter=1)
arrow_s = S('AR', font='CaveatBold', size=16, color=PURPLE, align=TA_CENTER, spaceBefore=0, spaceAfter=0)
caps_s = S('CA', font='CaveatBold', size=16, color=RED, align=TA_CENTER, spaceBefore=2, spaceAfter=2)
note_s = S('NS', font='Caveat', size=12, color=colors.HexColor('#555555'), indent=12)
sub_lbl = S('SL', font='CaveatBold', size=15, color=TEAL, spaceBefore=6, spaceAfter=2)
def HR(w='100%', color=LINE_C, thick=0.5):
return HRFlowable(width=w, thickness=thick, color=color, spaceAfter=4, spaceBefore=4)
def SP(h=5):
return Spacer(1, h)
def Bullet(text, style=body_k):
return Paragraph(f"• {text}", style)
story = []
# ══════════════════════════════════════════════════════════════════════
# GAMETOGENESIS
# ══════════════════════════════════════════════════════════════════════
story.append(Paragraph("Gametogenesis", main_title))
story.append(HR(thick=1.0, color=PINK))
story.append(SP(4))
story.append(Paragraph(
"The process involved in maturation of two highly specialized cells — "
"spermatozoon in male & ovum in female — before they unite to form a <b>zygote</b>.",
body_b))
story.append(SP(12))
# ══════════════════════════════════════════════════════════════════════
# OOGENESIS
# ══════════════════════════════════════════════════════════════════════
story.append(Paragraph("⇒ Oogenesis", h1))
story.append(Paragraph("<b>def<sup>n</sup> :</b> Process involved in the development of mature ovum.", def_lbl))
story.append(SP(6))
story.append(Paragraph("Process :-", proc_lbl))
oog_steps = [
"1. Primitive germ cell take origin from <b>YOLK SAC</b> about end of 3<sup>rd</sup> week & migrate to <b>gonadal ridge</b> about end of 4<sup>th</sup> week.",
"2. In female gonads (ovary), germ cell undergo mitotic division & differentiate into <b>oogonia</b>.",
"3. At 20<sup>th</sup> week, about <b>7 million oogonia</b>.",
"4. Oogonia continue to divide & form <b>Primary oocyte</b>. These surrounded by flat cells & k/a <b>primordial follicles</b> — present in cortex of ovary.",
"5. At birth: <b>NO MORE MITOTIC DIVISION</b> & all oogonia replaced by primary oocyte — remain in <b>resting phase (dictyotene stage)</b> b/w prophase and metaphase.",
"6. Total no of oocyte at birth is about <b>2 million</b>.",
"7. Primary oocyte do <b>not</b> finish division until puberty.",
"8. At puberty, <b>4,00,000 oocyte</b> left behind; rest being atretic — <b>400</b> are likely to ovulate during reproductive period.",
]
for step in oog_steps:
story.append(Paragraph(step, body_k))
story.append(SP(3))
story.append(SP(10))
story.append(HR())
# Maturation flowchart
story.append(Paragraph("Maturation :-", proc_lbl))
story.append(SP(4))
def flow_box(items):
"""Create a centered flowchart from a list of (text, is_arrow, color)."""
for text, is_arr, col in items:
if is_arr:
story.append(Paragraph(text, arrow_s))
elif col == 'caps':
story.append(Paragraph(f'<font color="#cc0066"><b>{text}</b></font>', caps_s))
elif col == 'bold':
story.append(Paragraph(text, flow_bold))
else:
story.append(Paragraph(text, flow_c))
story.append(SP(1))
flow_box([
("Germ cells", False, ''),
("↓ mitosis", True, ''),
("Oogonia", False, ''),
("↓", True, ''),
("Primary oocyte (46, XX)", False, ''),
("↓", True, ''),
("Arrested first meiotic division (upto puberty)", False, ''),
("↓", True, ''),
("Maturation of Graafian follicle", False, ''),
("↓ (completion of 1st meiotic div)", True, ''),
("OVULATION", False, 'caps'),
])
story.append(SP(8))
# Two-column branch after ovulation
w = doc.width
split_data = [
[Paragraph("<b><u>Not Fertilized</u></b>", body_k),
Paragraph("<b><u>Fertilized</u></b>", body_k)],
[Paragraph("↓", arrow_s), Paragraph("↓", arrow_s)],
[Paragraph("Degeneration within 24 hrs", body_k),
Paragraph("Completion of 2<sup>nd</sup> meiotic div", body_k)],
[Paragraph("↓", arrow_s), Paragraph("↓", arrow_s)],
[Paragraph("—", body_k),
Paragraph("Female pronucleus (23, X)<br/>+ 2<sup>nd</sup> polar body (23, X)", body_k)],
]
t = Table(split_data, colWidths=[w/2 - 4, w/2 - 4])
t.setStyle(TableStyle([
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('LINEAFTER', (0,0), (0,-1), 0.6, colors.HexColor('#aaaaaa')),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(t)
story.append(SP(14))
story.append(HR())
# ══════════════════════════════════════════════════════════════════════
# OVULATION
# ══════════════════════════════════════════════════════════════════════
story.append(Paragraph("⇒ Ovulation", h1))
story.append(Paragraph(
"<b>def<sup>n</sup> :</b> Process where a secondary oocyte is released from ovary following "
"rupture of mature Graafian follicle and becomes available for conception.",
def_lbl))
story.append(SP(5))
for txt in [
"• Starts at puberty; ends at menopause",
"• Occurs on <b>14<sup>th</sup> day</b> of menstrual cycle",
"• Remains suspended during pregnancy and Lactation",
]:
story.append(Paragraph(txt, body_b))
story.append(SP(2))
story.append(SP(8))
story.append(Paragraph("Mechanism :- Changes occur in both follicle and oocyte", sub_lbl))
story.append(Paragraph("STEPS :", proc_lbl))
steps_ovul = [
"1. Movement of Graafian follicle to the ovary surface & enlarges in size about <b>20 mm</b>.",
"2. <b>Cumulus oophorus</b> (cluster of granulosa cells) floats in antrum (cavity of follicle).",
"3. Follicular wall near ovarian surface becomes <b>thin</b>.",
"4. <b>Stigma</b> develops on surface of mature Graafian follicle just before ovulation.",
"5. Cumulus escapes out of follicle as a <b>slow-oozing process</b> taking about 1-2 mins with large amount of follicular fluid ⇒ <b>Ovulation</b>.",
"6. Steg closed by plug of plasma. In oocyte — completion of arrested 1<sup>st</sup> meiotic division → 1<sup>st</sup> polar body + <b>Secondary oocyte</b>.",
]
for s in steps_ovul:
story.append(Paragraph(s, body_k))
story.append(SP(3))
story.append(SP(8))
story.append(Paragraph("Cause :-", sub_lbl))
for txt in [
"Combined <b>LH / FSH midcycle surge</b> responsible for maturation, rupture & expulsion of oocyte.",
"⇒ <b>LH :</b> Sustained peak level of estrogen for <b>24-36 hrs</b> causes LH surge.",
"⇒ <b>FSH :</b> Positive feedback of estrogen induces FSH surge — causes increase in plasminogen activator & helps in lysis <b>(PLASMIN)</b>.",
]:
story.append(Paragraph(txt, body_k))
story.append(SP(3))
story.append(SP(8))
story.append(Paragraph("Effect :-", sub_lbl))
for txt in [
"• Following ovulation → change to <b>Corpus Luteum</b>",
"• Ovum passes into <b>Fallopian tube</b>",
"• Menstruation is unrelated with ovulation",
"• Common in adolescence & in women approaching menopause",
]:
story.append(Paragraph(txt, body_k))
story.append(SP(2))
story.append(SP(10))
story.append(HR())
# Graafian follicle diagram — text labels
story.append(Paragraph("Graafian Follicle — Structure Labels", h2))
for lbl in [
"Ovarian stroma (outermost layer)",
"Theca externa",
"Theca interna",
"Oocyte (central cell)",
"Antrum (fluid-filled cavity)",
"Cumulus oophorus cells (surround oocyte)",
"Oocyte in 2<sup>nd</sup> meiotic division (after LH surge)",
]:
story.append(Paragraph(f" ↳ {lbl}", note_s))
story.append(SP(2))
story.append(SP(12))
story.append(HR())
# ══════════════════════════════════════════════════════════════════════
# SPERMATOGENESIS
# ══════════════════════════════════════════════════════════════════════
story.append(Paragraph("⇒ Spermatogenesis", h1))
story.append(Paragraph(
"<b>def :</b> Process involved in development of spermatids from primordial germ cells "
"and their differentiation into spermatozoa.",
def_lbl))
story.append(SP(6))
story.append(Paragraph("Process :-", proc_lbl))
def stage_row(step_text, stage_label):
row = [[
Paragraph(step_text, flow_c),
Paragraph(f'<font color="#6600cc"><b>⊙ {stage_label}</b></font>',
ParagraphStyle('sr', fontName='CaveatBold', fontSize=13,
textColor=PURPLE, leading=18)),
]]
t = Table(row, colWidths=[w * 0.62, w * 0.38])
t.setStyle(TableStyle([
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('TOPPADDING', (0,0), (-1,-1), 2),
('BOTTOMPADDING', (0,0), (-1,-1), 2),
]))
return t
story.append(stage_row("Primordial germ cells", "PROLIFERATION"))
story.append(Paragraph("↓ Mitosis", arrow_s))
story.append(Paragraph("Spermatogonia (remain in wall of seminiferous tubules)", flow_c))
story.append(Paragraph("↓", arrow_s))
story.append(stage_row("Primary spermatocyte (46, XY) — about 16 days", "GROWTH"))
story.append(Paragraph(' <font color="#888888"><i>(remain in stage of primary prophase)</i></font>',
ParagraphStyle('sm', fontName='Caveat', fontSize=12,
textColor=colors.HexColor('#888888'), leading=16, leftIndent=10)))
story.append(Paragraph("↓", arrow_s))
story.append(Paragraph("First meiotic division", flow_c))
story.append(Paragraph("↓", arrow_s))
story.append(stage_row("Secondary spermatocyte", "MATURATION"))
story.append(SP(4))
spl = Table([[Paragraph("23, X", flow_bold), Paragraph("23, Y", flow_bold)]],
colWidths=[w/2 - 4, w/2 - 4])
spl.setStyle(TableStyle([
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('LINEAFTER', (0,0), (0,-1), 0.5, colors.HexColor('#aaaaaa')),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(spl)
story.append(Paragraph("↓ Second meiotic division", arrow_s))
story.append(SP(4))
chrom = Table([[Paragraph("23, X", flow_bold), Paragraph("23, X", flow_bold),
Paragraph("23, Y", flow_bold), Paragraph("23, Y", flow_bold)]],
colWidths=[w/4]*4)
chrom.setStyle(TableStyle([
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('BOX', (0,0), (-1,-1), 0.5, colors.HexColor('#aaaaaa')),
('TOPPADDING', (0,0), (-1,-1), 3),
('BOTTOMPADDING', (0,0), (-1,-1), 3),
]))
story.append(chrom)
story.append(Paragraph("↓", arrow_s))
story.append(stage_row("Spermatids", "TRANSFORMATION"))
story.append(Paragraph("↓ <b>Spermiogenesis</b>", arrow_s))
story.append(Paragraph("Morphological change occurs to form <b>Spermatozoa</b>", flow_c))
story.append(Paragraph("↓", arrow_s))
story.append(Paragraph("<b>Mature spermatogonium (About 61 days)</b>", flow_bold))
story.append(SP(8))
story.append(Paragraph(
"<b>Spermiation :</b> Process by which matured sperms are released from "
"<b>Sertoli cells</b> into the lumen of seminiferous tubules.",
body_k))
story.append(SP(12))
story.append(HR())
# ══════════════════════════════════════════════════════════════════════
# SPERM CAPACITATION & ACROSOME REACTION
# ══════════════════════════════════════════════════════════════════════
story.append(Paragraph("Sperm Capacitation and Acrosome Reaction :-", h2))
for txt in [
"• Physiochemical change in sperm by which it becomes <b>hypermotile</b> & is able to bind & fertilize secondary oocyte.",
"• Occurs in <b>genital tract</b> & takes about <b>2-6 hrs</b>.",
"• <b>Acrosome reaction</b> → Triggered when sperm binds to zona pellucida <b>(ZP3)</b>.",
"• Release of <b>hyaluronidase</b>, hydrolytic enzyme, proacrosin, acrosin — helps sperm to digest zona pellucida & enter oocyte.",
]:
story.append(Paragraph(txt, body_k))
story.append(SP(3))
story.append(SP(8))
story.append(Paragraph("SPERM — Structure", sub_lbl))
sperm_parts = [
("<b>Acrosome</b>", "Tip of head — contains hydrolytic enzymes (hyaluronidase, acrosin)"),
("<b>Head</b>", "Contains nucleus with condensed chromosomal DNA"),
("<b>Neck</b>", "Short narrow region — connects head to midpiece"),
("<b>Midpiece</b>", "Contains mitochondria — generates ATP for flagellar movement"),
("<b>Mitochondria</b>","Coiled around axoneme in midpiece"),
("<b>Tail (Flagellum)</b>", "Long structure for motility (axoneme = 9+2 microtubule arrangement)"),
("<b>End piece</b>", "Terminal tip of the tail"),
]
sperm_rows = [[Paragraph(p, body_k), Paragraph(d, body_k)] for p, d in sperm_parts]
t_sp = Table(sperm_rows, colWidths=[w * 0.30, w * 0.70])
t_sp.setStyle(TableStyle([
('BACKGROUND', (0,0), (0,-1), colors.HexColor('#eef0ff')),
('LINEBELOW', (0,0), (-1,-2), 0.3, LINE_C),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 6),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('BOX', (0,0), (-1,-1), 0.5, colors.HexColor('#aaaaaa')),
]))
story.append(t_sp)
story.append(SP(14))
story.append(HR(thick=1.2, color=PINK))
# ══════════════════════════════════════════════════════════════════════
# FERTILIZATION
# ══════════════════════════════════════════════════════════════════════
story.append(Paragraph("Fertilization", main_title))
story.append(HR(thick=1.0, color=PINK))
story.append(SP(4))
story.append(Paragraph(
"<b>def :</b> Is the process of <b>fusion of spermatozoon with mature ovum</b>. "
"Occurs in <b>Ampullary part of Fallopian tube</b>.",
def_lbl))
story.append(SP(5))
for txt in [
"<b>Lifespan :</b> Ovum (oocyte) = <b>12-14 hrs</b> | Sperm = <b>48-72 hrs</b>",
"Millions of sperms are ejaculated, but only <b>300-500 reach ovum</b>.",
]:
story.append(Paragraph(txt, body_b))
story.append(SP(3))
story.append(SP(8))
story.append(Paragraph("Process : Contact and Fusion of Gametes", sub_lbl))
fert_steps = [
"1. Sperm releases <b>hyaluronidase</b> from acrosome which dissolves <b>corona radiata</b> of ovum, allowing sperm to pass.",
"2. Sperm penetrates <b>zona pellucida</b> by acrosome reaction (enzymes) — many sperm can penetrate the zona.",
"3. Only <b>one sperm</b> out of many touches & fuses with the <b>oolemma</b> (egg cell membrane).",
"4. After sperm fusion, penetration of other sperm is prevented by <b>zona reaction (hardening)</b> & <b>oolemma block</b>.",
"5. <b>Completion of Meiosis II :</b> Secondary oocyte completes second meiotic division. Forms:<br/> → <b>Female pronucleus</b><br/> → <b>Second polar body</b>",
"6. <b>Formation of Pronuclei :</b> Both the head and tail of sperm enter oocyte & sperm nucleus forms <b>male pronucleus</b>. The male & female pronuclei fuse to restore <b>46 chromosomes</b>, resulting in formation of <b>Zygote</b> (contains genetic material from both parents).",
"7. <b>Sex Determination</b> (by SPERM) :<br/> X sperm + X ovum → <b>XX (Female)</b><br/> Y sperm + X ovum → <b>XY (Male)</b>",
"8. <b>Cleavage</b> formation begins after fertilization.",
]
for step in fert_steps:
story.append(Paragraph(step, body_k))
story.append(SP(4))
story.append(SP(8))
story.append(Paragraph("Fertilization Diagram — Key Labels", sub_lbl))
for lbl in [
"Acrosome-intact sperm head (approaching zona pellucida)",
"Fully acrosome-reacted sperm head (penetrating zona)",
"Corona cells (granulosa cells surrounding egg)",
"Zona pellucida (glycoprotein coat around egg)",
"Perivitelline space (space between oolemma & zona)",
"Vesiculating sperm head within ooplasm",
"⇒ Fertilization (completed)",
]:
story.append(Paragraph(f" ↳ {lbl}", note_s))
story.append(SP(2))
# Footer note
story.append(SP(16))
story.append(HR(thick=1.0, color=PINK))
story.append(Paragraph(
"<b>Topics covered :</b> Gametogenesis | Oogenesis | Maturation | "
"Ovulation (Mechanism, Cause, Effect) | Spermatogenesis | "
"Sperm Capacitation & Acrosome Reaction | Fertilization",
ParagraphStyle('footer', fontName='Caveat', fontSize=11,
textColor=colors.HexColor('#666666'), alignment=TA_CENTER, leading=16)))
doc.build(story)
print(f"✓ PDF saved: {OUTPUT}")
build()
cd /home/daytona/workspace/gametogenesis-notes && python generate_handwritten.py…
ls -lh /home/daytona/workspace/gametogenesis-notes/*.pdf
Gametogenesis Handwritten Notes
PDF Document · PDF