Feb-19-2019, 12:14 PM
*** I Don't know why, I already tried to post this, but for some reason it seams that my post disappeared or was never posted (maybe I didn't press the right button). Anyway, if it got removed by a moderator because something was wrong, feel free to remove this one again, please just tell me what's wrong by PM. Thank you***
Hello,
I'm making a piece of software to control my printer by sending commands to it.
But now I got a big problem, which is that the printer wont do anything until I close the port.
Here is an example :
Any idea ?
Thank you in advance,
Clément.
Hello,
I'm making a piece of software to control my printer by sending commands to it.
But now I got a big problem, which is that the printer wont do anything until I close the port.
Here is an example :
from tkinter import * printer = open("/dev/lp0", "w") win = Tk() win.geometry("100x100") def send(text): printer.write(str(text)) #Print text printer.write("\x0A\x0D") #Line feed and carriage return textEntry = Entry(win) textEntry.pack() sendText = Button(win, text="Print", command=lambda:send(textEntry.get())) sendText.pack() win.mainloop() printer.close()When pressing any button, nothing happens until I close the window.
Any idea ?
Thank you in advance,
Clément.