Thanks a lot. And about if I need to save each invoice as an archive and see the number of each invoice and make next and previous buttons to enable update for each invoice. How could I make this if possible. And thank you again.
Hi hala its realy amazing this video.. can you please add to it CRUD method like create, search, update, save, delete and print on hard copy? Pleasee, i tried for months and i failed, i think thousands of people want and need it.. please consider it.. thanks 🙏🏻🙏🏻🙏🏻
Amazing, thanks a ton! Your videos are incredibly helpful. For anyone that's interested, I found a way to edit the tree: def delete_item(): selected_item = tree.selection()[0] tree.delete(selected_item) Put this command in for a delete button you create and you should be able to select items from the tree and delete them without having to reset your entire invoice.
def Remove_items(): for i in table.selection(): id = i idx = table.index(id) table.delete(id) del invoice_list[idx] i made somethig like this to delete multiple items and also fron the invoice_list too
Hi, Hala I love ❤❤your videos. I have one request can you please make a video where you use a pdf file instead of a word document. thank you so much this really helped
Thank you so much for this helpful video, but I have a question as I have tried so much to show for example this word file in the frame in Tkinter, could you please help me with that?
I actually didn't knew treeview was supposed to be used as a table render widget. I figure it was for showing up file system stuff like files and directories. Thanks for this tkinter tutorial
Minor point, your Total should be the SubTotal plus the tax percentage of SubTotal... ie SubTotal $33.5, Tax 10% therefore: Total === $36.85 not $30.12... Unless you were thinking a discount, however a discount should be applied per item not just on total invoice. Cheers.
Thank you for the great tutorial. By the way, just note that when you used the module datetime and made it add time to the filename, the last digits were not just seconds. The first digits indicated the hours however using the 24-hour clock format, so as it was 8 PM on your PC, that became the number 20.
Hello Hala.. How are you? I have written same line of codes and it’s not updating the values in the.docx file. What might be the problem please and what can I do? Thank you
Great tutorial. Can you make a video on how to create also a record of the invoices as well as means to conclude which have been payed or not along with the saved invoice. Maybe a database SQLite and have the means to switch between displayed pages depending on which is wanted for viewing at the time.
Do you think I can use python to pull data from Google docs once created and then put them into Google sheets of invoice template? and then have it covert to pdf and email to be send? Is this automation process possible?
You explained it well. Can you do a video how to save data in to excel file to a format , I created a recipe saving app but I cannot figure out how to save the recipe in to a format. My current version it just saves in to pdf without template , as a chef I am very happy that I was able to created the gui app to that far 😂
thanks you so much your videos are amazing i only saw the part of docTemplate working and intro of the video and Tried to made this myself here is the version i made i added 2 extra features like removing the items , saving as a new file to a directory the code is this from customtkinter import * import tkinter.ttk as ttk import tkinter as tk from docxtpl import DocxTemplate import tkinter.filedialog as fd import tkinter.messagebox as tmsg import os root = CTk() set_appearance_mode('dark') root.title("Invoice Generator") root.geometry("800x580") # creating widgets cfont = CTkFont(family="Sans Serif",size=20,weight="bold",) head = CTkLabel(root,text="Invoice Generator",font=cfont) head.place(relx = 0.5,rely =0,anchor = "n") EntriesFrame = CTkFrame(root) EntriesFrame.place(relx = 0,rely = 0.07,relwidth = 1) l1 = CTkLabel(EntriesFrame,text="First Name") l2 = CTkLabel(EntriesFrame,text="Last Name") l3 = CTkLabel(EntriesFrame,text="Phone Number") l4 = CTkLabel(EntriesFrame,text="Qty") l5 = CTkLabel(EntriesFrame,text="Description ") l6 = CTkLabel(EntriesFrame,text="Unit Price") e1 = CTkEntry(EntriesFrame) e2 = CTkEntry(EntriesFrame) e3 = CTkEntry(EntriesFrame) e5 = CTkEntry(EntriesFrame) style = ttk.Style() print(style.theme_names()) style.theme_use("default") style.configure('C.TSpinbox', background ='gray14', arrowcolor ="gray84", foreground="gray84", fieldbackground = "#343638", bordercolor ="yellow", padding = (5,5), arrowsize = 12, selectbackground ="#1f538d", insertwidth = 10 ) qtyvar = IntVar(value=0) spb4 = ttk.Spinbox(EntriesFrame,from_=0,to=100,textvariable=qtyvar,style='C.TSpinbox') unitpricevar = DoubleVar(value=0.00) spb6= ttk.Spinbox(EntriesFrame,from_=0.00,to=5000.00,increment=0.5,textvariable=unitpricevar,style='C.TSpinbox') invoice_list = [] i =0 # function to get the final cost of each item , qty*unitproce def Add_lnTotal(x): linetotal = x[0]*x[2] x.insert(3,linetotal) return x # to Sum the list Elements def sumlist(x): sum = 0 for i in x: sum+=i return sum def calc_subtotal(): global subtotal linetotal = [x[3] for x in invoice_list] subtotal = sum(linetotal) return subtotal # functio to Calculate Tax from String def total_with_tax(t,s): tax_dig = int(t.split('%')[0][:1]) tax = float(f"0.{tax_dig}") return s*tax+s def Calc_Total(): global total total = total_with_tax("10%",calc_subtotal()) def Add_items(): global fname,lname,phone,Desc,i global Qty,UnitPrice,items,invoice_list,linetotal,subtotal,total fname = e1.get() lname = e2.get() phone = e3.get() Desc = e5.get() Qty = qtyvar.get() UnitPrice = unitpricevar.get()
# MAKING A 2D INVOICE LIST items = [Qty,Desc,UnitPrice] invoice_list.append(Add_lnTotal(items))
flag = tmsg.askyesno("Create File","Want To Create a New File ?") if flag : fdir = fd.askdirectory( title="Save file To" ) inpd =CTkInputDialog(title="Enter Name",text="Enter The the name of the File") filename = f"{inpd.get_input()}" file_path = f"{fdir}/{filename}.docx" write_data(file_path) tmsg.showinfo("Success",f"Generated At {file_path}") else: file_path = "Records.docx" write_data(file_path) tmsg.showinfo("Success","Your Invoice hava Been Generated Succesfully in Default Directory")
Very good Hala! Your explanation is structured, clear, you have a wonderful voice, your speak is clear like water, have a good pace to understand every word. This reports example is very good. Have you made some report example using sqlite data?
please guys i'm getting an error at 8minute of the video please help me !!! here is the error : raise PackageNotFoundError( docx.opc.exceptions.PackageNotFoundError: Package not found at 'template.docx' that is the last line of the error
This is absolutely amazing tutorial! I started binge watching your channel, you’ve uploaded so much great stuff.
Hi Hala can you show it with pyside6
Thanks a lot. And about if I need to save each invoice as an archive and see the number of each invoice and make next and previous buttons to enable update for each invoice. How could I make this if possible. And thank you again.
And save all data into sqlite3 thanks so much
Wow you are genious.. i searched this more than half a year 🙏🏻🙏🏻🙏🏻
Hi hala its realy amazing this video.. can you please add to it CRUD method like create, search, update, save, delete and print on hard copy? Pleasee, i tried for months and i failed, i think thousands of people want and need it.. please consider it.. thanks 🙏🏻🙏🏻🙏🏻
Amazing, thanks a ton! Your videos are incredibly helpful.
For anyone that's interested, I found a way to edit the tree:
def delete_item():
selected_item = tree.selection()[0]
tree.delete(selected_item)
Put this command in for a delete button you create and you should be able to select items from the tree and delete them without having to reset your entire invoice.
def Remove_items():
for i in table.selection():
id = i
idx = table.index(id)
table.delete(id)
del invoice_list[idx]
i made somethig like this to delete multiple items and also fron the invoice_list too
Hi Hala can you show it with pyside6 ?
thanks
why does an error occur saying like 'Package not found at .docx'
Hi, Hala I love ❤❤your videos. I have one request can you please make a video where you use a pdf file instead of a word document.
thank you so much this really helped
Just conevert using doxc2pdf
Thank you so much for this helpful video, but I have a question as I have tried so much to show for example this word file in the frame in Tkinter, could you please help me with that?
I actually didn't knew treeview was supposed to be used as a table render widget. I figure it was for showing up file system stuff like files and directories. Thanks for this tkinter tutorial
Minor point, your Total should be the SubTotal plus the tax percentage of SubTotal...
ie SubTotal $33.5, Tax 10% therefore: Total === $36.85 not $30.12...
Unless you were thinking a discount, however a discount should be applied per item not just on total invoice.
Cheers.
Thank you for the great tutorial. By the way, just note that when you used the module datetime and made it add time to the filename, the last digits were not just seconds. The first digits indicated the hours however using the 24-hour clock format, so as it was 8 PM on your PC, that became the number 20.
Hello Hala.. How are you?
I have written same line of codes and it’s not updating the values in the.docx file.
What might be the problem please and what can I do?
Thank you
Great tutorial.
Can you make a video on how to create also a record of the invoices as well as means to conclude which have been payed or not along with the saved invoice. Maybe a database SQLite and have the means to switch between displayed pages depending on which is wanted for viewing at the time.
Thank u so much mam 100% working
Very nice. Thank you so much for your videos. Greetings from Germany
where the additem function is add the previous list of invoice_item since we are not using the append ??? please let me know.
Hi this video tutorial is not bright
I want to save the generated invoice in pdf form ,What should I do for that?
I want to save the generated invoice in pdf form ,What should I do for that?
Can pyside6 use this?
Do you think I can use python to pull data from Google docs once created and then put them into Google sheets of invoice template? and then have it covert to pdf and email to be send? Is this automation process possible?
I've been binging several of your tkinter videos since I found your channel this morning. Insanely good content, thank you SO MUCH for your efforts.
You explained it well. Can you do a video how to save data in to excel file to a format , I created a recipe saving app but I cannot figure out how to save the recipe in to a format. My current version it just saves in to pdf without template , as a chef I am very happy that I was able to created the gui app to that far 😂
I prefer PysimpleGui, for this one will be easy make the interface
thanks you so much your videos are amazing i only saw the part of docTemplate working and intro of the video and Tried to made this myself here is the version i made
i added 2 extra features like removing the items , saving as a new file to a directory
the code is this
from customtkinter import *
import tkinter.ttk as ttk
import tkinter as tk
from docxtpl import DocxTemplate
import tkinter.filedialog as fd
import tkinter.messagebox as tmsg
import os
root = CTk()
set_appearance_mode('dark')
root.title("Invoice Generator")
root.geometry("800x580")
# creating widgets
cfont = CTkFont(family="Sans Serif",size=20,weight="bold",)
head = CTkLabel(root,text="Invoice Generator",font=cfont)
head.place(relx = 0.5,rely =0,anchor = "n")
EntriesFrame = CTkFrame(root)
EntriesFrame.place(relx = 0,rely = 0.07,relwidth = 1)
l1 = CTkLabel(EntriesFrame,text="First Name")
l2 = CTkLabel(EntriesFrame,text="Last Name")
l3 = CTkLabel(EntriesFrame,text="Phone Number")
l4 = CTkLabel(EntriesFrame,text="Qty")
l5 = CTkLabel(EntriesFrame,text="Description ")
l6 = CTkLabel(EntriesFrame,text="Unit Price")
e1 = CTkEntry(EntriesFrame)
e2 = CTkEntry(EntriesFrame)
e3 = CTkEntry(EntriesFrame)
e5 = CTkEntry(EntriesFrame)
style = ttk.Style()
print(style.theme_names())
style.theme_use("default")
style.configure('C.TSpinbox',
background ='gray14',
arrowcolor ="gray84",
foreground="gray84",
fieldbackground = "#343638",
bordercolor ="yellow",
padding = (5,5),
arrowsize = 12,
selectbackground ="#1f538d",
insertwidth = 10
)
qtyvar = IntVar(value=0)
spb4 = ttk.Spinbox(EntriesFrame,from_=0,to=100,textvariable=qtyvar,style='C.TSpinbox')
unitpricevar = DoubleVar(value=0.00)
spb6= ttk.Spinbox(EntriesFrame,from_=0.00,to=5000.00,increment=0.5,textvariable=unitpricevar,style='C.TSpinbox')
invoice_list = []
i =0
# function to get the final cost of each item , qty*unitproce
def Add_lnTotal(x):
linetotal = x[0]*x[2]
x.insert(3,linetotal)
return x
# to Sum the list Elements
def sumlist(x):
sum = 0
for i in x:
sum+=i
return sum
def calc_subtotal():
global subtotal
linetotal = [x[3] for x in invoice_list]
subtotal = sum(linetotal)
return subtotal
# functio to Calculate Tax from String
def total_with_tax(t,s):
tax_dig = int(t.split('%')[0][:1])
tax = float(f"0.{tax_dig}")
return s*tax+s
def Calc_Total():
global total
total = total_with_tax("10%",calc_subtotal())
def Add_items():
global fname,lname,phone,Desc,i
global Qty,UnitPrice,items,invoice_list,linetotal,subtotal,total
fname = e1.get()
lname = e2.get()
phone = e3.get()
Desc = e5.get()
Qty = qtyvar.get()
UnitPrice = unitpricevar.get()
# MAKING A 2D INVOICE LIST
items = [Qty,Desc,UnitPrice]
invoice_list.append(Add_lnTotal(items))
# counting Subtotal &
# Caluting Total after including Tax
# with one function call
Calc_Total()
tempdata = Add_lnTotal(items)
tempdata.pop()
data=tuple(tempdata)
table.insert(parent = '',index=i,values=data)
i+=1
print(data)
print(invoice_list)
# print(f"First Name:{fname}, Last Name : {lname},
"
# f"Phone Number :{phone}, Description :{Desc}"
# f"Qty : {Qty}, Unit Price : {UnitPrice}"
# )
def Remove_items():
for i in table.selection():
id = i
idx = table.index(id)
table.delete(id)
del invoice_list[idx]
Calc_Total()
print(subtotal)
print(invoice_list)
addbtn = CTkButton(EntriesFrame,text="Add Item",command=Add_items)
Removebtn = CTkButton(EntriesFrame,text="Remove Item",command=Remove_items)
# making Grids
EntriesFrame.columnconfigure((0,1,2),weight=1)
EntriesFrame.rowconfigure((0,1,2,3,4),weight=1)
# placing widgets
l1.grid(row = 0,column = 0)
e1.grid(row = 1,column = 0)
l2.grid(row = 0,column = 1)
e2.grid(row = 1,column = 1)
l3.grid(row = 0,column = 2)
e3.grid(row = 1,column = 2)
l4.grid(row = 2,column = 0)
spb4.grid(row =3 ,column = 0)
l5.grid(row = 2,column = 1)
e5.grid(row = 3,column = 1)
l6.grid(row = 2,column = 2)
spb6.grid(row = 3,column = 2)
addbtn.grid(row= 4 ,column = 1,sticky = "news",padx = 60,pady = 20)
Removebtn.grid(row= 4 ,column = 2,sticky = "news",padx = 60,pady = 20)
infoFrame = CTkFrame(root,fg_color="gray14",corner_radius=0)
style.configure("table.Treeview",fieldbackground = "gray17",foregorund = "white")
style.configure("table.Treeview.Heading")
table = ttk.Treeview(infoFrame,style = 'table.Treeview',columns=(0,1,2,4),show='headings')
table.heading(0,text="QTY")
table.heading(1,text="Description")
table.heading(2,text="Unit Price")
table.heading(3,text="Total")
table.place(relx = 0.072,rely = 0.04,relwidth=0.86,relheight = 0.96)
infoFrame.place(relx = 0 ,rely = 0.38,relwidth = 1,relheight=0.46)
global generate_invoice
def generate_invoice():
def write_data(x):
doc = DocxTemplate("invoice_template.docx")
doc.render({
"name":f"{fname}{lname}",
"phone" : phone,
"invoice_list":invoice_list,
"subtotal":subtotal,
"salestax":"10%",
"total":total
})
doc.save(x)
flag = tmsg.askyesno("Create File","Want To Create a New File ?")
if flag :
fdir = fd.askdirectory(
title="Save file To"
)
inpd =CTkInputDialog(title="Enter Name",text="Enter The the name of the File")
filename = f"{inpd.get_input()}"
file_path = f"{fdir}/{filename}.docx"
write_data(file_path)
tmsg.showinfo("Success",f"Generated At {file_path}")
else:
file_path = "Records.docx"
write_data(file_path)
tmsg.showinfo("Success","Your Invoice hava Been Generated Succesfully in Default Directory")
frameBtn =CTkFrame(root,fg_color="gray18")
btn1 = CTkButton(frameBtn,text="Generate Invoice",command=generate_invoice)
btn1.pack(fill=X,pady = 5,padx = 60)
btn2 = CTkButton(frameBtn,text="New Invoice")
btn2.pack(fill=X,padx = 60,pady =5)
frameBtn.place(relx = 0,rely = 0.853,relwidth = 1)
root.mainloop()
Every bit of your tutorial is very understable and good, you are good in explaning code
Can you make one more video this. How to create exe file
BROTHER, YOU ARE THE BEST!!! You oooh really helped me!! THANK YOU VERY MUCH!
Very good Hala! Your explanation is structured, clear, you have a wonderful voice, your speak is clear like water, have a good pace to understand every word. This reports example is very good. Have you made some report example using sqlite data?
hi great tutorial, how to make all of this into exe format?
This channel will reach 1 million subscribed, I promise 💙
The stuff which i was looking for.......thanks for sharing!
Macha Allah, you are the best Hala in the world! I mean it.
Amazing tutorail Thank you. please is there a way to edit or delete an item in the list?
Hi Hala can make Django videos 🙏🏻
Hey Hala, I just wanted to thank you for this kind of videos, I am really enjoying them
Ilove the all series of template projects. Thanks
Thank you God bless you mam
excellent tutorial, well explained, keep moving !!!!
Nice work girl , amazing project 🎉
what a life saver ....... ......thank you🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
Very helpful, thank you!
why they do not use the open document format?
Super Tutorial Thank you Hala
You are great! Thanks!
Awesome tutorial! Is there a way to put a business logo on this?
Yes. You can customize the docx template to suit your need.
Great video. I am Learning a lot
HI HALA THANK YOU FOR YOUR EFFECT ON THIS VIDEO
You're the best Nala!!!
Thank you again!!!
Awesome tutorial
Great video.. thank you 🙂
😍💗😍💗😍💗😍🤩🤩🤩🤩
Great
Thank you.
Good information
So Helpful
Thanks.❤
Brilliant tutorial ❤❤❤thank you.
please guys i'm getting an error at 8minute of the video please help me !!! here is the error :
raise PackageNotFoundError(
docx.opc.exceptions.PackageNotFoundError: Package not found at 'template.docx'
that is the last line of the error
did you have the Word template downloaded in your programs files?
pip install docxtpl