I use code from this question for printing to thermal EPSON TM-T82 printer but when I modified it with tkinter
and mainloop()
python not direcly printout my data until I close my layout GUI. I want this script can print out my data without I close layout GUI.
This is my code:
import subprocess
from Tkinter import *
class tes_print:
def __init__(self):
self.printData()
def printData(self):
data = " MY TEXT "
lpr = subprocess.Popen("/usr/bin/lpr", stdin=subprocess.PIPE, shell=True)
lpr.stdin.write(data)
root = Tk()
app2 = tes_print()
root.mainloop()