Python Forum
[Tkinter] How to print data to the printer
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to print data to the printer
#6
I get the following error code: NameError: name 'tempfile' is not defined


printText =Label(root, text="hello")
print(printText)
filename = tempfile.mktemp(".txt")
open(filename, "w").write(printText)
# Bellow is call to print text from your_widget_name textbox
win32api.ShellExecute(0,"printto", filename, '"%s"' % win32print.GetDefaultPrinter(), ".", 0)
Reply


Messages In This Thread
How to print data to the printer - by scratchmyhead - May-23-2020, 06:56 PM
RE: How to print data to the printer - by DT2000 - May-23-2020, 09:37 PM
RE: How to print data to the printer - by DT2000 - May-26-2020, 01:43 PM
RE: How to print data to the printer - by scratchmyhead - May-27-2020, 04:58 PM
RE: How to print data to the printer - by menator01 - May-27-2020, 10:19 PM
RE: How to print data to the printer - by menator01 - May-28-2020, 04:46 AM
RE: How to print data to the printer - by StevenLee - Aug-20-2020, 08:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with the printer function scratchmyhead 4 3,405 Oct-15-2020, 12:14 PM
Last Post: YvonneAlsop
  setup epson lq350 dot matrix printer by python-printer-escpos gray 10 9,255 Jun-05-2017, 01:20 PM
Last Post: sparkz_alot
  the rs232 printer is not working gray 10 8,912 May-17-2017, 09:21 AM
Last Post: gray

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020