May-12-2020, 09:26 PM
I'm trying to print data to the printer but get an error code: TypeError: to_printer() missing 1 required positional argument: 'text'
The code is below:
The code is below:
from tkinter import * import tkinter as tk root = Tk() root.state('zoomed') root.title('Hotel King Ver 1.8') def to_printer(text): import subprocess lpr = subprocess.Popen("/usr/bin/lpr", stdin=subprocess.PIPE) lpr.stdin.write(text) print_button = tk.Button(root, text="print", command=to_printer) print_button.pack() root.mainloop()