Prepare colorful handbook pdf of 20 list of conversation questions ( logical questions and not funny)for my ESL student of 3rd grade on topic " Describing things and people" by looking at picturres ( like photo of what's inside library, how English teacher looks ,the school playground etc)also do mention their answers.Please also write Russian translation under every sentence. Don't mention anything extra information in pdf that it's for ESL 3rd grade student etc. Example is mentioned here:: 1. In the picture, I see a big library. 2. There are many books on the shelves. 3. The shelves are tall and brown. 4. Some books are red and blue. 5. Some books are green and yellow. 6. There is a librarian sitting at the desk. 7. The librarian is wearing glasses. 8. She is smiling at the children. 9. There is a computer on the desk. 10. Two children are sitting at a table. 11. They are reading picture books. 12. A boy is holding a blue book. 13. A girl is pointing at a picture. 14. There is a large window behind them. 15. The sun is shining through the window. 16. There is a plant next to the window. 17. The plant is green and tall. 18. There is a return cart near the door. 19. There are magazines on a small table. 20. The library is quiet and peaceful.
You wrote "20 list of conversation questions" - do you mean 20 separate picture topics (each with its own list of ~20 questions, like the library example), or fewer topics (e.g. just library, teacher, playground) with 20 questions each? · How should the PDF look?
inside of a library with bookshelves and children reading
friendly smiling teacher standing in classroom
school playground with children playing outside
A colorful illustration of the inside of a school library with tall bookshelves full of books, a librarian at a desk, and children reading at a table near a window
A colorful illustration of a friendly smiling English teacher standing in front of a classroom blackboard, wearing glasses
A colorful illustration of a school playground with a slide, swings, and children playing outside on a sunny day
Where is my handbook pdf?I want it fast
A colorful illustration of the inside of a school library with tall bookshelves full of books, a librarian at a desk, and children reading at a table near a window
mkdir -p /tmp/workspace/esl-handbook/assets /tmp/workspace/esl-handbook/output && ls -la /tmp/workspace/
cd /tmp/workspace/esl-handbook/assets && curl -s -o library.png "https://cdn.orris.care/image-gen/8d268ea33b644d2786cf328bc536d515.png" && curl -s -o teacher.png "https://cdn.orris.care/image-gen/49e2db22759b46c38197d721db42dd04.png" && curl -s -o playground.png "https://cdn.orris.care/image-gen/4cb2f606e6164a2f87db91660bfa96ea.png" && ls -la
~/esl-handbook/build_pdf.py
# -*- coding: utf-8 -*-
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm
from reportlab.lib import colors
from reportlab.pdfgen import canvas
from reportlab.lib.utils import ImageReader
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import textwrap, glob
# Find a font that supports Cyrillic
font_reg = None
font_bold = None
font_it = None
candidates = glob.glob("/usr/share/fonts/**/*.ttf", recursive=True)
def pick(keyword_list):
for c in candidates:
low = c.lower()
if all(k in low for k in keyword_list):
return c
return None
reg_path = pick(["dejavusans"]) or pick(["freesans"])
bold_path = pick(["dejavusans", "bold"]) or reg_path
it_path = pick(["dejavusans", "oblique"]) or pick(["dejavusans", "italic"]) or reg_path
if reg_path:
pdfmetrics.registerFont(TTFont("Body", reg_path))
FONT_REG = "Body"
else:
FONT_REG = "Helvetica"
if bold_path:
pdfmetrics.registerFont(TTFont("BodyBold", bold_path))
FONT_BOLD = "BodyBold"
else:
FONT_BOLD = "Helvetica-Bold"
if it_path:
pdfmetrics.registerFont(TTFont("BodyIt", it_path))
FONT_IT = "BodyIt"
else:
FONT_IT = "Helvetica-Oblique"
PAGE_W, PAGE_H = A4
MARGIN = 1.6 * cm
# ---------- Content ----------
SECTIONS = [
{
"title": "The Library",
"image": "assets/library.png",
"color": colors.HexColor("#2E86AB"),
"light": colors.HexColor("#EAF4FB"),
"items": [
("What do you see in the picture?", "Что ты видишь на картинке?",
"I see a big library.", "Я вижу большую библиотеку."),
("What is on the shelves?", "Что стоит на полках?",
"There are many books on the shelves.", "На полках много книг."),
("What do the shelves look like?", "Как выглядят полки?",
"The shelves are tall and brown.", "Полки высокие и коричневые."),
("What color are some of the books?", "Какого цвета некоторые книги?",
"Some books are red and blue.", "Некоторые книги красные и синие."),
("What color are other books?", "Какого цвета другие книги?",
"Some books are green and yellow.", "Некоторые книги зелёные и жёлтые."),
("Who is sitting at the desk?", "Кто сидит за столом?",
"There is a librarian sitting at the desk.", "За столом сидит библиотекарь."),
("What is the librarian wearing?", "Что носит библиотекарь?",
"The librarian is wearing glasses.", "Библиотекарь носит очки."),
("What is the librarian doing?", "Что делает библиотекарь?",
"She is smiling at the children.", "Она улыбается детям."),
("What is on the desk?", "Что стоит на столе?",
"There is a computer on the desk.", "На столе стоит компьютер."),
("Who is sitting at the table?", "Кто сидит за столом?",
"Two children are sitting at a table.", "Двое детей сидят за столом."),
("What are they doing?", "Что они делают?",
"They are reading picture books.", "Они читают книги с картинками."),
("What is the boy holding?", "Что держит мальчик?",
"A boy is holding a blue book.", "Мальчик держит синюю книгу."),
("What is the girl doing?", "Что делает девочка?",
"A girl is pointing at a picture.", "Девочка показывает на картинку."),
("What is behind them?", "Что находится позади них?",
"There is a large window behind them.", "Позади них большое окно."),
("What is happening at the window?", "Что происходит у окна?",
"The sun is shining through the window.", "Солнце светит через окно."),
("What is next to the window?", "Что стоит рядом с окном?",
"There is a plant next to the window.", "Рядом с окном стоит растение."),
("What does the plant look like?", "Как выглядит растение?",
"The plant is green and tall.", "Растение зелёное и высокое."),
("What is near the door?", "Что находится возле двери?",
"There is a return cart near the door.", "Возле двери стоит тележка для книг."),
("What is on the small table?", "Что лежит на маленьком столе?",
"There are magazines on a small table.", "На маленьком столе лежат журналы."),
("How does the library feel?", "Какая атмосфера в библиотеке?",
"The library is quiet and peaceful.", "В библиотеке тихо и спокойно."),
],
},
{
"title": "My English Teacher",
"image": "assets/teacher.png",
"color": colors.HexColor("#E4572E"),
"light": colors.HexColor("#FDEDE7"),
"items": [
("Who do you see in the picture?", "Кого ты видишь на картинке?",
"I see my English teacher.", "Я вижу свою учительницу английского языка."),
("Where is she standing?", "Где она стоит?",
"She is standing in front of the blackboard.", "Она стоит перед доской."),
("What does she look like?", "Как она выглядит?",
"She has short brown hair.", "У неё короткие каштановые волосы."),
("What is she wearing on her face?", "Что у неё на лице?",
"She is wearing glasses.", "Она носит очки."),
("What color is her dress?", "Какого цвета её платье?",
"Her dress is blue and white.", "Её платье синее и белое."),
("What is she holding?", "Что она держит?",
"She is holding a book.", "Она держит книгу."),
("What is she doing with her hand?", "Что она делает рукой?",
"She is pointing at the board.", "Она показывает на доску."),
("What is written on the board?", "Что написано на доске?",
"There are some English words on the board.", "На доске написаны английские слова."),
("What color is the board?", "Какого цвета доска?",
"The board is green.", "Доска зелёная."),
("What is on the teacher's desk?", "Что лежит на столе учительницы?",
"There are pens and papers on the desk.", "На столе лежат ручки и бумаги."),
("What is next to the desk?", "Что стоит рядом со столом?",
"There is a chair next to the desk.", "Рядом со столом стоит стул."),
("How does the teacher look?", "Как выглядит учительница?",
"The teacher looks kind and happy.", "Учительница выглядит доброй и весёлой."),
("What is she doing with the students?", "Что она делает с учениками?",
"She is talking to the students.", "Она разговаривает с учениками."),
("What are the students doing?", "Что делают ученики?",
"The students are listening carefully.", "Ученики внимательно слушают."),
("What is on the wall?", "Что висит на стене?",
"There is a colorful poster on the wall.", "На стене висит цветной плакат."),
("What is on the poster?", "Что изображено на плакате?",
"The poster shows the alphabet.", "На плакате изображён алфавит."),
("What is near the window?", "Что стоит у окна?",
"There is a small plant near the window.", "У окна стоит маленькое растение."),
("What color are the walls?", "Какого цвета стены?",
"The walls are light yellow.", "Стены светло-жёлтые."),
("What is the teacher wearing on her feet?", "Что носит учительница на ногах?",
"She is wearing black shoes.", "Она носит чёрные туфли."),
("How do the students feel?", "Как чувствуют себя ученики?",
"The students feel happy in her class.", "Ученики чувствуют себя счастливыми на её уроке."),
],
},
{
"title": "The School Playground",
"image": "assets/playground.png",
"color": colors.HexColor("#2A9D8F"),
"light": colors.HexColor("#E6F5F3"),
"items": [
("What do you see in the picture?", "Что ты видишь на картинке?",
"I see a school playground.", "Я вижу школьную площадку."),
("What is in the middle of the playground?", "Что находится в центре площадки?",
"There is a big slide in the middle.", "В центре площадки есть большая горка."),
("What color is the slide?", "Какого цвета горка?",
"The slide is red and yellow.", "Горка красная и жёлтая."),
("What are the children doing on the slide?", "Что делают дети на горке?",
"Two children are sliding down.", "Двое детей катаются с горки."),
("What is next to the slide?", "Что находится рядом с горкой?",
"There are swings next to the slide.", "Рядом с горкой есть качели."),
("Who is on the swings?", "Кто сидит на качелях?",
"A girl is sitting on a swing.", "Девочка сидит на качелях."),
("What is she doing?", "Что она делает?",
"She is swinging high in the air.", "Она качается высоко в воздухе."),
("What is on the ground?", "Что на земле?",
"There is soft green grass on the ground.", "На земле мягкая зелёная трава."),
("What are some children doing on the grass?", "Что делают некоторые дети на траве?",
"Some children are running on the grass.", "Некоторые дети бегают по траве."),
("What are the boys playing?", "Во что играют мальчики?",
"The boys are playing with a ball.", "Мальчики играют в мяч."),
("What color is the ball?", "Какого цвета мяч?",
"The ball is orange and white.", "Мяч оранжевый и белый."),
("What is behind the playground?", "Что находится за площадкой?",
"There is a school building behind the playground.", "За площадкой находится школьное здание."),
("What color is the school building?", "Какого цвета школьное здание?",
"The building is white and blue.", "Здание белое и синее."),
("What is above the playground?", "Что над площадкой?",
"The sky is bright and blue.", "Небо яркое и синее."),
("What is in the sky?", "Что на небе?",
"There are a few white clouds in the sky.", "На небе несколько белых облаков."),
("What is near the fence?", "Что находится возле забора?",
"There are tall trees near the fence.", "Возле забора растут высокие деревья."),
("What color are the trees?", "Какого цвета деревья?",
"The trees are green.", "Деревья зелёные."),
("Who is watching the children?", "Кто наблюдает за детьми?",
"A teacher is watching the children.", "Учительница наблюдает за детьми."),
("What is she doing?", "Что она делает?",
"She is standing near the bench.", "Она стоит возле скамейки."),
("How do the children feel?", "Как чувствуют себя дети?",
"The children are happy and excited.", "Дети счастливы и взволнованы."),
],
},
]
def wrap_text(c, text, font, size, max_width):
c.setFont(font, size)
words = text.split(" ")
lines, cur = [], ""
for w in words:
trial = (cur + " " + w).strip()
if c.stringWidth(trial, font, size) <= max_width:
cur = trial
else:
if cur:
lines.append(cur)
cur = w
if cur:
lines.append(cur)
return lines
def draw_cover(c):
c.setFillColor(colors.HexColor("#3D348B"))
c.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
# decorative circles
deco_colors = ["#F7B801", "#F18701", "#F35B04", "#7678ED"]
import random
random.seed(7)
for i in range(14):
r = random.uniform(0.4, 1.6) * cm
x = random.uniform(0, PAGE_W)
y = random.uniform(0, PAGE_H)
c.setFillColor(colors.HexColor(random.choice(deco_colors)))
c.setFillAlpha(0.35)
c.circle(x, y, r, fill=1, stroke=0)
c.setFillAlpha(1)
title = "Describing Things and People"
c.setFillColor(colors.white)
c.setFont(FONT_BOLD, 30)
lines = wrap_text(c, title, FONT_BOLD, 30, PAGE_W - 4*cm)
y = PAGE_H/2 + 2.4*cm
for ln in lines:
c.drawCentredString(PAGE_W/2, y, ln)
y -= 1.1*cm
c.setFont(FONT_IT, 16)
c.setFillColor(colors.HexColor("#FFE066"))
c.drawCentredString(PAGE_W/2, y - 0.4*cm, "Look at the picture and talk about it")
y -= 1.1*cm
c.setFont(FONT_REG, 14)
c.setFillColor(colors.HexColor("#D6D6F5"))
c.drawCentredString(PAGE_W/2, y - 0.2*cm, "Смотри на картинку и рассказывай")
# three small colored bars representing chapters
bar_colors = ["#2E86AB", "#E4572E", "#2A9D8F"]
total_w = 3*4*cm + 2*0.6*cm
start_x = PAGE_W/2 - total_w/2
by = 3.2*cm
for i, bc in enumerate(bar_colors):
c.setFillColor(colors.HexColor(bc))
c.roundRect(start_x + i*(4*cm+0.6*cm), by, 4*cm, 0.9*cm, 6, fill=1, stroke=0)
c.setFont(FONT_BOLD, 11)
c.setFillColor(colors.white)
labels = ["Library", "Teacher", "Playground"]
for i, lb in enumerate(labels):
c.drawCentredString(start_x + i*(4*cm+0.6*cm) + 2*cm, by + 0.3*cm, lb)
c.showPage()
def draw_section_header(c, section, page_no_holder):
color = section["color"]
light = section["light"]
c.setFillColor(light)
c.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
# top color band
band_h = 8.6*cm
c.setFillColor(color)
c.rect(0, PAGE_H - band_h, PAGE_W, band_h, fill=1, stroke=0)
# image
try:
img = ImageReader(section["image"])
iw, ih = img.getSize()
max_w = PAGE_W - 2*MARGIN
max_h = band_h - 2.2*cm
scale = min(max_w/iw, max_h/ih)
dw, dh = iw*scale, ih*scale
ix = (PAGE_W - dw) / 2
iy = PAGE_H - 1.0*cm - dh
# white frame
pad = 0.25*cm
c.setFillColor(colors.white)
c.roundRect(ix-pad, iy-pad, dw+2*pad, dh+2*pad, 8, fill=1, stroke=0)
c.drawImage(img, ix, iy, width=dw, height=dh, mask='auto')
except Exception as e:
pass
c.setFillColor(colors.white)
c.setFont(FONT_BOLD, 22)
c.drawCentredString(PAGE_W/2, PAGE_H - band_h + 0.7*cm, section["title"])
def draw_footer(c, page_num):
c.setFont(FONT_REG, 9)
c.setFillColor(colors.grey)
c.drawCentredString(PAGE_W/2, 0.8*cm, str(page_num))
def build():
c = canvas.Canvas("output/Handbook.pdf", pagesize=A4)
draw_cover(c)
page_num = 2
for section in SECTIONS:
draw_section_header(c, section, None)
y_start = PAGE_H - 8.6*cm - 0.7*cm
y = y_start
x = MARGIN
content_w = PAGE_W - 2*MARGIN
for idx, (q_en, q_ru, a_en, a_ru) in enumerate(section["items"], start=1):
# Estimate block height first
num_str = f"{idx}."
q_lines_en = wrap_text(c, q_en, FONT_BOLD, 11.5, content_w - 1.1*cm)
q_lines_ru = wrap_text(c, q_ru, FONT_IT, 10, content_w - 1.1*cm)
a_lines_en = wrap_text(c, a_en, FONT_BOLD, 11.5, content_w - 1.1*cm)
a_lines_ru = wrap_text(c, a_ru, FONT_IT, 10, content_w - 1.1*cm)
line_h = 0.44*cm
block_h = (len(q_lines_en) + len(q_lines_ru) + len(a_lines_en) + len(a_lines_ru)) * line_h + 0.55*cm
if y - block_h < 1.3*cm:
draw_footer(c, page_num)
c.showPage()
page_num += 1
c.setFillColor(section["light"])
c.rect(0, 0, PAGE_W, PAGE_H, fill=1, stroke=0)
y = PAGE_H - MARGIN
box_top = y
box_bottom = y - block_h
c.setFillColor(colors.white)
c.roundRect(x, box_bottom, content_w, block_h, 6, fill=1, stroke=0)
c.setStrokeColor(section["color"])
c.setLineWidth(1)
c.roundRect(x, box_bottom, content_w, block_h, 6, fill=0, stroke=1)
ty = box_top - 0.4*cm
# Number badge
c.setFillColor(section["color"])
c.circle(x + 0.5*cm, ty - 0.05*cm, 0.32*cm, fill=1, stroke=0)
c.setFillColor(colors.white)
c.setFont(FONT_BOLD, 9.5)
c.drawCentredString(x + 0.5*cm, ty - 0.09*cm - 0.09*cm, str(idx))
tx = x + 1.05*cm
c.setFillColor(colors.HexColor("#1B1B1B"))
for ln in q_lines_en:
c.setFont(FONT_BOLD, 11.5)
c.drawString(tx, ty, ln)
ty -= line_h
c.setFillColor(section["color"])
for ln in q_lines_ru:
c.setFont(FONT_IT, 10)
c.drawString(tx, ty, ln)
ty -= line_h
ty -= 0.08*cm
c.setFillColor(colors.HexColor("#333333"))
for ln in a_lines_en:
c.setFont(FONT_BOLD, 11.5)
c.drawString(tx, ty, ln)
ty -= line_h
c.setFillColor(colors.HexColor("#555555"))
for ln in a_lines_ru:
c.setFont(FONT_IT, 10)
c.drawString(tx, ty, ln)
ty -= line_h
y = box_bottom - 0.35*cm
draw_footer(c, page_num)
c.showPage()
page_num += 1
c.save()
if __name__ == "__main__":
build()
print("done")
cd /tmp/workspace/esl-handbook && python3 build_pdf.py 2>&1 | tail -40
ls -la /tmp/workspace/esl-handbook/output/ && python3 -c " import pypdf r = pypdf.PdfReader('/tmp/workspace/esl-handbook/output/Handbook.pdf') print('pages', len(r.pages)) "
Handbook
PDF Document · PDF
Make a presentation slide deck showing the three picture scenarios for classroom use
ls -la /tmp/workspace/esl-handbook/assets/
~/esl-handbook/build_pptx.py
# -*- coding: utf-8 -*-
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.enum.shapes import MSO_SHAPE
from PIL import Image
SLIDE_W = Inches(13.333)
SLIDE_H = Inches(7.5)
SECTIONS = [
{
"title": "The Library",
"image": "assets/library.png",
"color": RGBColor(0x2E, 0x86, 0xAB),
"light": RGBColor(0xEA, 0xF4, 0xFB),
"questions": [
"What do you see in the picture?",
"What is on the shelves?",
"Who is sitting at the desk?",
"What are the children doing?",
"How does the library feel?",
],
},
{
"title": "My English Teacher",
"image": "assets/teacher.png",
"color": RGBColor(0xE4, 0x57, 0x2E),
"light": RGBColor(0xFD, 0xED, 0xE7),
"questions": [
"Who do you see in the picture?",
"Where is she standing?",
"What does she look like?",
"What is she doing with the students?",
"How do the students feel?",
],
},
{
"title": "The School Playground",
"image": "assets/playground.png",
"color": RGBColor(0x2A, 0x9D, 0x8F),
"light": RGBColor(0xE6, 0xF5, 0xF3),
"questions": [
"What do you see in the picture?",
"What is in the middle of the playground?",
"What are the children doing?",
"What is above the playground?",
"How do the children feel?",
],
},
]
prs = Presentation()
prs.slide_width = SLIDE_W
prs.slide_height = SLIDE_H
blank_layout = prs.slide_layouts[6]
def add_bg(slide, color):
slide.background.fill.solid()
slide.background.fill.fore_color.rgb = color
def add_text(slide, x, y, w, h, text, size, color, bold=False, italic=False, align=PP_ALIGN.CENTER, font="Calibri"):
box = slide.shapes.add_textbox(x, y, w, h)
tf = box.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.alignment = align
run = p.add_run()
run.text = text
run.font.size = Pt(size)
run.font.bold = bold
run.font.italic = italic
run.font.color.rgb = color
run.font.name = font
return box
# ---------- Title slide ----------
slide = prs.slides.add_slide(blank_layout)
add_bg(slide, RGBColor(0x3D, 0x34, 0x8B))
deco_colors = [RGBColor(0xF7, 0xB8, 0x01), RGBColor(0xF1, 0x87, 0x01), RGBColor(0xF3, 0x5B, 0x04), RGBColor(0x76, 0x78, 0xED)]
import random
random.seed(3)
for i in range(10):
size = Inches(random.uniform(0.4, 1.3))
left = Inches(random.uniform(0, 13))
top = Inches(random.uniform(0, 7))
shp = slide.shapes.add_shape(MSO_SHAPE.OVAL, left, top, size, size)
shp.fill.solid()
shp.fill.fore_color.rgb = random.choice(deco_colors)
shp.line.fill.background()
shp.shadow.inherit = False
add_text(slide, Inches(1), Inches(2.5), Inches(11.33), Inches(1.2),
"Describing Things and People", 40, RGBColor(0xFF, 0xFF, 0xFF), bold=True)
add_text(slide, Inches(1), Inches(3.6), Inches(11.33), Inches(0.6),
"Look at the picture and talk about it", 20, RGBColor(0xFF, 0xE0, 0x66), italic=True)
add_text(slide, Inches(1), Inches(4.2), Inches(11.33), Inches(0.6),
"Смотри на картинку и рассказывай", 16, RGBColor(0xD6, 0xD6, 0xF5), italic=True)
# three chapter bars
bar_w = Inches(3.2)
gap = Inches(0.4)
total_w = bar_w * 3 + gap * 2
start_x = Emu(int((SLIDE_W - total_w) / 2))
by = Inches(5.4)
labels = ["Library", "Teacher", "Playground"]
bar_colors = [RGBColor(0x2E, 0x86, 0xAB), RGBColor(0xE4, 0x57, 0x2E), RGBColor(0x2A, 0x9D, 0x8F)]
for i, (lb, bc) in enumerate(zip(labels, bar_colors)):
left = Emu(int(start_x + i * (bar_w + gap)))
shp = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE, left, by, bar_w, Inches(0.7))
shp.fill.solid()
shp.fill.fore_color.rgb = bc
shp.line.fill.background()
shp.shadow.inherit = False
tf = shp.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.alignment = PP_ALIGN.CENTER
run = p.add_run()
run.text = lb
run.font.size = Pt(16)
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
# ---------- Section slides ----------
for section in SECTIONS:
slide = prs.slides.add_slide(blank_layout)
add_bg(slide, section["light"])
# top color band
band = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, SLIDE_W, Inches(0.9))
band.fill.solid()
band.fill.fore_color.rgb = section["color"]
band.line.fill.background()
band.shadow.inherit = False
tf = band.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.alignment = PP_ALIGN.CENTER
run = p.add_run()
run.text = section["title"]
run.font.size = Pt(28)
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
tf.vertical_anchor = MSO_ANCHOR.MIDDLE
# image left side, fitted, with white frame
img_path = section["image"]
with Image.open(img_path) as im:
iw, ih = im.size
max_w_in = 6.6
max_h_in = 5.6
scale = min(max_w_in / iw, max_h_in * 96 / ih) if False else min(max_w_in, max_h_in * iw / ih) / iw
# simpler: compute display size preserving aspect within box
box_w, box_h = Inches(6.6), Inches(5.6)
ratio = iw / ih
disp_w = box_w
disp_h = Emu(int(box_w / ratio))
if disp_h > box_h:
disp_h = box_h
disp_w = Emu(int(box_h * ratio))
left = Inches(0.6)
top = Inches(1.5)
frame = slide.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE,
Emu(int(left) - Inches(0.08)), Emu(int(top) - Inches(0.08)),
Emu(int(disp_w) + Inches(0.16)), Emu(int(disp_h) + Inches(0.16)))
frame.fill.solid()
frame.fill.fore_color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
frame.line.fill.background()
frame.shadow.inherit = False
slide.shapes.add_picture(img_path, left, top, width=disp_w, height=disp_h)
# questions on right side
qx = Inches(7.5)
qy = Inches(1.5)
qw = Inches(5.4)
add_text(slide, qx, qy, qw, Inches(0.5), "Talk about the picture:", 18, section["color"], bold=True, align=PP_ALIGN.LEFT)
qy2 = Inches(2.1)
for i, q in enumerate(section["questions"], start=1):
box = slide.shapes.add_textbox(qx, qy2, qw, Inches(0.9))
tf = box.text_frame
tf.word_wrap = True
p = tf.paragraphs[0]
p.alignment = PP_ALIGN.LEFT
run = p.add_run()
run.text = f"{i}. {q}"
run.font.size = Pt(15)
run.font.color.rgb = RGBColor(0x33, 0x33, 0x33)
qy2 = Emu(int(qy2) + Inches(0.95))
prs.save("output/Classroom_Slides.pptx")
print("done")
cd /tmp/workspace/esl-handbook && python3 build_pptx.py 2>&1 | tail -40
ls -la /tmp/workspace/esl-handbook/output/
Classroom Slides
Presentation · PPTX
Please create 10 similar related topics on description of person and things and places with a photo on top as mentioned in above prepared handbook and 20 questions with their answers and Russian translation under every sentence for each photo
A colorful illustration of a bright elementary school classroom with a whiteboard, rows of desks with students, and a teacher standing near the board
A colorful illustration of a cozy child's bedroom with a bed, pillows, a small desk, a toy box, and a rug
A colorful illustration of a home kitchen with a table, chairs, a stove, a refrigerator, and a woman cooking food
A colorful illustration of a public park with a pond with ducks, a bench under a tree, people walking, and a boy flying a kite
A colorful illustration of a zoo with an elephant, two giraffes, a lion in an enclosure, and monkeys in trees
A colorful illustration of a supermarket interior with shelves full of food, a woman pushing a shopping cart, and a cashier at checkout
A colorful illustration of a friendly doctor in a white coat with a stethoscope examining a young child patient in a clinic room
A colorful illustration of a farmer wearing a straw hat standing in a large field with a tractor, rows of corn, and a red barn
A colorful illustration of a sunny beach with children building a sandcastle, a sailboat on the sea, and palm trees
A colorful illustration of a happy family of five sitting together in a living room with a sofa and family photos on the wall
Handbook
PDF Document · PDF
Classroom Slides
Presentation · PPTX
Error calling model 'gemini-3-pro-image' (RESOURCE_EXHAUSTED): 429 RESOURCE_EXHAUSTED. {'error': {'code': 429, 'message': 'Resource has been exhausted (e.g. check quota).', 'status': 'RESOURCE_EXHAUSTED'}}
We encountered an error while processing your request. Please try again or reach out to us for help.
Error calling model 'gemini-3-pro-image' (RESOURCE_EXHAUSTED): 429 RESOURCE_EXHAUSTED. {'error': {'code': 429, 'message': 'Resource has been exhausted (e.g. check quota).', 'status': 'RESOURCE_EXHAUSTED'}}
We encountered an error while processing your request. Please try again or reach out to us for help.
Please create 10 similar related topics on description of person and things and places with as mentioned in about prepared handbook and 20 questions with their answers and Russian translation under every sentence.
Please create 10 similar related topics on description of person and things and places with as mentioned in about prepared handbook and 20 questions with their answers and Russian translation under every sentence.
I want my handbook pdf , please be fast
I want my handbook pdf , please be fast
Please create 10 similar related topics on description of person and things and places with as mentioned in about prepared handbook and 20 questions with their answers and Russian translation under every sentence.
Please create 10 similar related topics on description of person and things and places with as mentioned in about prepared handbook and 20 questions with their answers and Russian translation under every sentence.
Retry ,I want my handbook pdf fsst
Retry ,I want my handbook pdf fsst