Sina Media Lab
commited on
Commit
·
0fdb658
1
Parent(s):
ad8f626
Updates
Browse files
app.py
CHANGED
@@ -35,28 +35,18 @@ def reset_pdf_cache():
|
|
35 |
def generate_pdf_report():
|
36 |
pdf = FPDF()
|
37 |
pdf.add_page()
|
38 |
-
pdf.set_font("Arial", style='B', size=
|
39 |
|
40 |
# Title of the report
|
41 |
pdf.cell(0, 10, txt="Magic Math Quiz", ln=True, align="C")
|
42 |
pdf.ln(5)
|
43 |
|
44 |
-
# Load the image from the local directory, scaled down
|
45 |
-
pdf.image("assets/gt.png", x=
|
46 |
pdf.ln(10)
|
47 |
|
48 |
for i, entry in enumerate(st.session_state.questions):
|
49 |
-
pdf.set_fill_color(0, 0, 0) # Black background
|
50 |
-
pdf.set_text_color(255, 255, 255) # White text
|
51 |
-
pdf.set_font("Arial", style='B', size=12)
|
52 |
-
pdf.cell(0, 10, f"Category: {entry['category']} > Module: {entry['module_title']}", ln=True, align="L", fill=True)
|
53 |
-
|
54 |
-
pdf.set_text_color(0, 0, 0) # Reset text color to black
|
55 |
pdf.set_font("Arial", size=12)
|
56 |
-
pdf.ln(5)
|
57 |
-
|
58 |
-
# Question number and text
|
59 |
-
pdf.set_font("Arial", style='B', size=12)
|
60 |
pdf.multi_cell(0, 10, f"Q{i+1}: {entry['question']}")
|
61 |
pdf.ln(3)
|
62 |
|
@@ -150,12 +140,13 @@ modules = load_modules()
|
|
150 |
st.sidebar.markdown(
|
151 |
"""
|
152 |
<div style='background-color: white; padding: 10px; border-radius: 10px; text-align: center; color: black;'>
|
153 |
-
<h1 style='margin: 0;'>🪄 Magic Math Quiz
|
|
|
|
|
|
|
|
|
154 |
""", unsafe_allow_html=True)
|
155 |
|
156 |
-
# Display the local image using st.image, scaled down
|
157 |
-
st.sidebar.image("assets/gt.png", use_column_width=True, width=100) # Adjusted to half its size
|
158 |
-
|
159 |
st.sidebar.title("Quiz Categories")
|
160 |
selected_category = st.sidebar.selectbox("Choose a category:", list(modules.keys()))
|
161 |
|
|
|
35 |
def generate_pdf_report():
|
36 |
pdf = FPDF()
|
37 |
pdf.add_page()
|
38 |
+
pdf.set_font("Arial", style='B', size=18)
|
39 |
|
40 |
# Title of the report
|
41 |
pdf.cell(0, 10, txt="Magic Math Quiz", ln=True, align="C")
|
42 |
pdf.ln(5)
|
43 |
|
44 |
+
# Load the image from the local directory, scaled down and centered
|
45 |
+
pdf.image("assets/gt.png", x=(210 - 25) / 2, w=25, link="https://ghassem.com") # Centered horizontally and scaled down
|
46 |
pdf.ln(10)
|
47 |
|
48 |
for i, entry in enumerate(st.session_state.questions):
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
pdf.set_font("Arial", size=12)
|
|
|
|
|
|
|
|
|
50 |
pdf.multi_cell(0, 10, f"Q{i+1}: {entry['question']}")
|
51 |
pdf.ln(3)
|
52 |
|
|
|
140 |
st.sidebar.markdown(
|
141 |
"""
|
142 |
<div style='background-color: white; padding: 10px; border-radius: 10px; text-align: center; color: black;'>
|
143 |
+
<h1 style='margin: 0;'>🪄 Magic Math Quiz<sup>Beta</sup>!</h1>
|
144 |
+
<a href="https://ghassem.com" target="_blank">
|
145 |
+
<img src="assets/gt.png" alt="Logo" style="width:50%; margin-top: 10px;">
|
146 |
+
</a>
|
147 |
+
</div>
|
148 |
""", unsafe_allow_html=True)
|
149 |
|
|
|
|
|
|
|
150 |
st.sidebar.title("Quiz Categories")
|
151 |
selected_category = st.sidebar.selectbox("Choose a category:", list(modules.keys()))
|
152 |
|