Python Forum
[Tkinter] load sqlite3 data into pdf
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] load sqlite3 data into pdf

I searched for code sample to learn how to put one of my db. table fields into pdf with many pages. Is there any tutorials out there that teaches how to deal with that, I heard about the reportlab library but I didn't find something dealing with sqlite3 tables.

I am trying to generate an exam report for students so I am taking the data from a table that holds all the candidate info, the questions, the answers, the student answer and the correct answer with total of marking and a pass or fail.

use pandas.
Here's an example:
rwahdan likes this post
(Jul-23-2021, 07:58 PM)Larz60+ Wrote: use pandas.
Here's an example:
Thank you very much this worked for me. Now, I have created the pdf and it is saved in the same directory. Is there a way to add button that can ask the user to save that same file to destination like save as?
#4 Wrote:The tkinter.filedialog module provides classes and factory functions for creating file/directory selection windows.
I did use the dialog like this:
        saveFilePath = filedialog.asksaveasfile(mode='w', title="Save the file", defaultextension=".pdf",
                        initialfile=pdf_file_name, filetypes=(("PDF Files", "*.pdf"),))

and I am able to save as pdf but when trying to open it, it says it is not type of pdf. In the project directory the file is opening though. I think this will only have a default name of saving a file but not choosing the file that I want to save.
I found a solution that suits me. the pdf will open after it is created then the user can choose to save it.
subprocess.Popen([pdf_file_name], shell=True)

Possibly Related Threads…
Thread Author Replies Views Last Post
  PyQt5 form not displaying my data from SQLite3 Database Linuxdesire 1 2,678 Dec-09-2019, 02:49 PM
Last Post: Denni
  [Tkinter] I need to know how to put my SQLite3 data into a Treeview Thename921 1 4,342 Jan-12-2019, 10:26 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020