Print The Receipt On Thermal Printer Python
i am creating a inventory system on python.i need genterating print recipt after all sales done.when i click save button.i have using mysql database. it has sales and sales product
Solution 1:
Here is how i think you should proceed with the reciept.
from tkinter import *
root = Tk()
defreciept():
top = Toplevel()
price1 = 3000
qty1 = 3
total1 = price1*qty1
price2 = 5000
qty2 = 4
total2 = price1*qty2
l = Label(top,text='---------RECIEPT----------')
l.pack()
heading = Label(top,text='PRICE\tQTY\tTOTAL')
heading.pack()
item1 = Label(top,text=f'{price1}\t{qty1}\t{total1}')
item1.pack()
item2 = Label(top,text=f'{price2}\t{qty2}\t{total2}')
item2.pack()
b = Button(root,text='Print reciept',command=reciept)
b.pack(padx=10,pady=10)
root.mainloop()
The \t
will add 4 spaces to the end of the letter.
You can replace prices with your e1.get()
and all.
You can also use grid()
here but it might be cumbersome and takes more lines.
Check here on how to print using python
Hope you got an idea.
Cheers
Post a Comment for "Print The Receipt On Thermal Printer Python"