8

I used Tkinter to draw some lines in python and I would like to print that picture to usb connected and/or network printer in Windows. How should I do that?

BK C.
  • 553
  • 2
  • 4
  • 13
  • Depends on your system. Are you on windows or another? – TheLazyScripter Apr 14 '16 at 15:59
  • thanks for pointing it out. it's Windows – BK C. Apr 14 '16 at 16:00
  • You need to first convert your graphics into an image file and then print that. Windows can print .bmp files natively, so that might be a good image file type to create. To get started see [_How can I convert canvas content to an image?_](http://stackoverflow.com/questions/9886274/how-can-i-convert-canvas-content-to-an-image) – martineau Apr 14 '16 at 16:22
  • Tim Golden has a good [_How do I print?_](http://timgolden.me.uk/python/win32_how_do_i/print.html) Python Stuff article that's Window specific. – martineau Apr 14 '16 at 16:32

1 Answers1

6

try this! It uses os module to start the file in the default printer!

import os

os.startfile("YourDocument", "print")
TheLazyScripter
  • 2,158
  • 1
  • 8
  • 17