Sina Media Lab
commited on
Commit
Β·
6789e51
1
Parent(s):
2b39dec
Updates
Browse files
app.py
CHANGED
@@ -55,15 +55,15 @@ def generate_pdf_report():
|
|
55 |
|
56 |
# Module Title
|
57 |
pdf.set_font("Arial", style='B', size=10)
|
58 |
-
pdf.multi_cell(0,
|
59 |
|
60 |
# Question
|
61 |
pdf.set_font("Arial", style='B', size=10)
|
62 |
-
pdf.multi_cell(0,
|
63 |
|
64 |
# Time Taken
|
65 |
pdf.set_font("Arial", size=10)
|
66 |
-
pdf.multi_cell(0,
|
67 |
|
68 |
# Options
|
69 |
pdf.set_font("Arial", size=10)
|
@@ -76,11 +76,11 @@ def generate_pdf_report():
|
|
76 |
else:
|
77 |
pdf.set_text_color(0, 0, 0) # Default color for others
|
78 |
|
79 |
-
pdf.multi_cell(0,
|
80 |
|
81 |
pdf.set_text_color(0, 0, 0) # Reset color
|
82 |
-
pdf.multi_cell(0,
|
83 |
-
pdf.multi_cell(0,
|
84 |
pdf.ln(5)
|
85 |
|
86 |
return pdf.output(dest='S').encode('latin-1', 'replace')
|
@@ -152,12 +152,12 @@ if selected_category:
|
|
152 |
selected_module_data = module_data
|
153 |
break
|
154 |
|
155 |
-
# Display PDF report icon
|
156 |
st.markdown(
|
157 |
f"""
|
158 |
-
<div style="margin-top: 10px;">
|
159 |
-
<span style='font-size: 18px; color:
|
160 |
-
<a href='#' download='quiz_report.pdf' style='font-size: 18px; margin-left: 10px;' onclick='document.getElementById("pdf-link").click();'
|
161 |
</div>
|
162 |
""",
|
163 |
unsafe_allow_html=True
|
|
|
55 |
|
56 |
# Module Title
|
57 |
pdf.set_font("Arial", style='B', size=10)
|
58 |
+
pdf.multi_cell(0, 8, f"Module: {entry['module_title']}", border=1, fill=True)
|
59 |
|
60 |
# Question
|
61 |
pdf.set_font("Arial", style='B', size=10)
|
62 |
+
pdf.multi_cell(0, 8, f"Q{i+1}: {entry['question']}", border=1, fill=True)
|
63 |
|
64 |
# Time Taken
|
65 |
pdf.set_font("Arial", size=10)
|
66 |
+
pdf.multi_cell(0, 8, f"Time Taken: {entry['time_taken']} seconds", border=1, fill=True)
|
67 |
|
68 |
# Options
|
69 |
pdf.set_font("Arial", size=10)
|
|
|
76 |
else:
|
77 |
pdf.set_text_color(0, 0, 0) # Default color for others
|
78 |
|
79 |
+
pdf.multi_cell(0, 6, f"{options[j]}. {option}", border=1, fill=True) # Reduced vertical spacing
|
80 |
|
81 |
pdf.set_text_color(0, 0, 0) # Reset color
|
82 |
+
pdf.multi_cell(0, 6, f"Explanation: {entry['explanation']}", border=1, fill=True) # Reduced vertical spacing
|
83 |
+
pdf.multi_cell(0, 6, f"Step-by-Step Solution: {', '.join(entry['step_by_step_solution'])}", border=1, fill=True) # Reduced vertical spacing
|
84 |
pdf.ln(5)
|
85 |
|
86 |
return pdf.output(dest='S').encode('latin-1', 'replace')
|
|
|
152 |
selected_module_data = module_data
|
153 |
break
|
154 |
|
155 |
+
# Display black background title with PDF report icon in front
|
156 |
st.markdown(
|
157 |
f"""
|
158 |
+
<div style="background-color: #333; padding: 10px; border-radius: 5px; margin-top: 10px;">
|
159 |
+
<span style='font-size: 18px; color: white;'>{selected_category} > {selected_module_data['title']}</span>
|
160 |
+
<a href='#' download='quiz_report.pdf' style='font-size: 18px; margin-left: 10px; color: white;' onclick='document.getElementById("pdf-link").click();'>π Download PDF Report</a>
|
161 |
</div>
|
162 |
""",
|
163 |
unsafe_allow_html=True
|