Preparing git repo for final project
This commit is contained in:
BIN
problems/pset8/shirtificate/shirtificate.pdf
Normal file
BIN
problems/pset8/shirtificate/shirtificate.pdf
Normal file
Binary file not shown.
BIN
problems/pset8/shirtificate/shirtificate.png
Normal file
BIN
problems/pset8/shirtificate/shirtificate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
22
problems/pset8/shirtificate/shirtificate.py
Normal file
22
problems/pset8/shirtificate/shirtificate.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from fpdf import FPDF
|
||||
|
||||
|
||||
def main():
|
||||
username = input("What's your name?\t\t")
|
||||
pdf = FPDF(orientation="P", unit="mm", format="A4")
|
||||
pdf.set_auto_page_break(False)
|
||||
pdf.add_page()
|
||||
pdf.set_font("helvetica", "B", 45)
|
||||
pdf.cell(0, 10, 'CS50 Shirtificate', new_x="LMARGIN", new_y="NEXT", align='C')
|
||||
page_width = pdf.w
|
||||
total_horizontal_margin = 0.2 * page_width
|
||||
image_width = pdf.w-total_horizontal_margin
|
||||
pdf.image("shirtificate.png", x=total_horizontal_margin/2, y=50, w=image_width)
|
||||
pdf.set_font("helvetica", "B", 32)
|
||||
pdf.set_text_color(255, 255, 255)
|
||||
pdf.cell(0, 230, f'{username} took CS50', new_x="LMARGIN", new_y="NEXT", align='C')
|
||||
pdf.output("shirtificate.pdf")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Reference in New Issue
Block a user