Wiki › Project

Thai OMR answer sheet generator

Article
From Chaipat's knowledge graph

Thai OMR answer sheet generator is a Python library that creates printable answer sheets for optical mark recognition (OMR) in Thai and English. He first wrote it so that a teacher could grade homework without checking every answer by hand, then rewrote and published it for others to use.

What it generates

  • Answer sheets with the exam title, subject, date and student details, and a QR code identifying the student.
  • Blank sheets for students to fill in themselves.
  • True/false tests, essay sections and sections with their own scores.
  • Answer keys.
  • Batches of sheets, from a list in code or from a CSV file of students.

Choices come in presets: Thai letters (ก ข ค ง, with or without จ), Thai true/false (ถูก/ผิด), English letters or numbers. Custom labels such as α β γ δ also work.

How it's built

It draws the PDFs with ReportLab, makes the QR codes with the qrcode package and bundles a Thai font, so the sheets look the same on any machine. An example run takes a few lines:

generator = OMRGenerator()
exam = ExamConfig(exam_title="สอบปลายภาคเรียนที่ 2", subject_name="วิทยาศาสตร์ (ป.4)")

The README's disclaimer is candid. The original code was messy, the published version was rewritten with an AI assistant, and some parts may still behave oddly.

See also