The Single Certificate Automation project automates the generation of personalized certificates for students completing specific courses. This project simplifies certificate creation by utilizing Python and libraries such as Tkinter for the GUI, docxtpl for templating, and docx2pdf for PDF conversion.
Users enter the student’s name, application number, and course completed. The application generates a certificate using a pre-defined Word document template, fills in the details, and saves the certificate in both DOCX and PDF formats. This project demonstrates Python’s capability for automating document creation and provides a user-friendly interface for ease of use.
Before starting with the Single Certificate Automation project, ensure you have the following:
By the end of this project, you will be able to:
Follow these steps to set up the Single Certificate Automation project:
This will launch the application, allowing you to generate certificates by entering the necessary details.
import tkinter
from tkinter import ttk
from tkinter import *
from docxtpl import DocxTemplate
from tkcalendar import Calendar
from datetime import datetime
from docx2pdf import convert
window = tkinter.Tk()
window.title("Generate edSlash Certificate")
frame = tkinter.Frame(window)
frame.pack(padx=60, pady=40)
def exit_app():
window.destroy()
def generat_certificate():
doc = DocxTemplate("Certificate_template.docx")
name = sname_entry.get()
application_no = application_entry.get()
cname = combo_box.get()
now = datetime.now()
current_date = now.date()
formatted_date = current_date.strftime('%d %B %Y')
doc.render({"name" :name,
"application_no" : application_no,
"course_name" :cname,
"date" : formatted_date})
exit_app()
doc_name = name +application_no +".docx"
doc.save(doc_name)
pdf_name = name +application_no +".docx"
convert(pdf_name)
print("Certificate Generate Successful ")
sname_label = tkinter.Label(frame, text = "Name")
sname_label.grid(row = 0,column = 0,padx = 20, pady=5,sticky ="w")
sname_entry = tkinter.Entry(frame)
sname_entry.grid(row = 0,column = 1,padx = 20, pady=5)
application_lebel = tkinter.Label(frame, text = "Application no.")
application_lebel.grid(row =1 ,column = 0,padx = 20,pady = 5,sticky = "w")
application_entry = tkinter.Entry(frame)
application_entry.grid(row = 1, column = 1, padx = 50,pady = 5)
course_label = tkinter.Label(frame, text = "Course Name")
course_label.grid(row = 2,column = 0,padx = 20, pady=5,sticky ="w")
combo_box = ttk.Combobox(frame, values=["Basic and Advance C programming",
"Basic and Advance C++ programming",
"Basic and Advance Python programming",
"Basic and Advance SQL programming",
"Data Science","Data Analysis",
"Machine Learning","Generative AI",])
combo_box.grid(row = 2,column = 1,padx = 20, pady=5)
generate_receipt_button = tkinter.Button(frame , text = "generate_certificate", command = generat_certificate)
generate_receipt_button.grid(row=3, column=0, columnspan = 2, sticky ="news",padx = 20, pady=5)
window.mainloop()
import tkinter
from tkinter import ttk
from tkinter import *
from docxtpl import DocxTemplate
from tkcalendar import Calendar
from datetime import datetime
from docx2pdf import convert
window = tkinter.Tk()
window.title("Generate edSlash Certificate")
frame = tkinter.Frame(window)
frame.pack(padx=60, pady=40)
def exit_app():
window.destroy()
def generat_certificate():
doc = DocxTemplate("Certificate_template.docx")
name = sname_entry.get()
application_no = application_entry.get()
cname = combo_box.get()
now = datetime.now()
current_date = now.date()
formatted_date = current_date.strftime('%d %B %Y')
doc.render({"name" :name,
"application_no" : application_no,
"course_name" :cname,
"date" : formatted_date})
exit_app()
doc_name = name +application_no +".docx"
doc.save(doc_name)
pdf_name = name +application_no +".docx"
convert(pdf_name)
print("Certificate Generate Successful ")
sname_label = tkinter.Label(frame, text = "Name")
sname_label.grid(row = 0,column = 0,padx = 20, pady=5,sticky ="w")
sname_entry = tkinter.Entry(frame)
sname_entry.grid(row = 0,column = 1,padx = 20, pady=5)
application_lebel = tkinter.Label(frame, text = "Application no.")
application_lebel.grid(row =1 ,column = 0,padx = 20,pady = 5,sticky = "w")
application_entry = tkinter.Entry(frame)
application_entry.grid(row = 1, column = 1, padx = 50,pady = 5)
course_label = tkinter.Label(frame, text = "Course Name")
course_label.grid(row = 2,column = 0,padx = 20, pady=5,sticky ="w")
combo_box = ttk.Combobox(frame, values=["Basic and Advance C programming",
"Basic and Advance C++ programming",
"Basic and Advance Python programming",
"Basic and Advance SQL programming",
"Data Science","Data Analysis",
"Machine Learning","Generative AI",])
combo_box.grid(row = 2,column = 1,padx = 20, pady=5)
generate_receipt_button = tkinter.Button(frame , text = "generate_certificate", command = generat_certificate)
generate_receipt_button.grid(row=3, column=0, columnspan = 2, sticky ="news",padx = 20, pady=5)
window.mainloop()
IMPORT necessary libraries (tkinter, ttk, docxtpl, tkcalendar, datetime, docx2pdf)
INITIALIZE main window
SET window title to "Generate edSlash Certificate"
CREATE frame within the window with padding
DEFINE function exit_app():
DESTROY the window
DEFINE function generate_certificate():
LOAD the Word document template "Certificate_template.docx"
GET student name from sname_entry
GET application number from application_entry
GET course name from combo_box
GET current date and format it as 'dd Month yyyy'
RENDER the template with:
name
application_no
course_name
date
SAVE the rendered document as DOCX
CONVERT the DOCX document to PDF
PRINT "Certificate Generate Successful"
CALL exit_app()
CREATE label and entry for student name
SET label text to "Name"
ADD entry field to the frame
CREATE label and entry for application number
SET label text to "Application no."
ADD entry field to the frame
CREATE label and combo box for course name
SET label text to "Course Name"
SET combo box values to list of courses
ADD combo box to the frame
CREATE button to generate certificate
SET button text to "Generate Certificate"
SET button command to call generate_certificate()
START main loop to display the window and handle user interactions
IMPORT necessary libraries (tkinter, ttk, docxtpl, tkcalendar, datetime, docx2pdf)
INITIALIZE main window
SET window title to "Generate edSlash Certificate"
CREATE frame within the window with padding
DEFINE function exit_app():
DESTROY the window
DEFINE function generate_certificate():
LOAD the Word document template "Certificate_template.docx"
GET student name from sname_entry
GET application number from application_entry
GET course name from combo_box
GET current date and format it as 'dd Month yyyy'
RENDER the template with:
name
application_no
course_name
date
SAVE the rendered document as DOCX
CONVERT the DOCX document to PDF
PRINT "Certificate Generate Successful"
CALL exit_app()
CREATE label and entry for student name
SET label text to "Name"
ADD entry field to the frame
CREATE label and entry for application number
SET label text to "Application no."
ADD entry field to the frame
CREATE label and combo box for course name
SET label text to "Course Name"
SET combo box values to list of courses
ADD combo box to the frame
CREATE button to generate certificate
SET button text to "Generate Certificate"
SET button command to call generate_certificate()
START main loop to display the window and handle user interactions
Check that the message appears at the correct time and provides clear feedback to the user.
Office:- 660, Sector 14A, Vasundhara, Ghaziabad, Uttar Pradesh - 201012, India