title: How to print line segment on a particular printer in python?
body: <p>I'm doing some test for a program. So basically what im trying to do is to send to a printer some lines like "---" but i can't draw them. I don't know how.</p>
  
  <p>I've tried all of those libraries like mathplotlib but it doesn't help because for me to send the info to the printer i have to send a string.</p>
  
  <pre><code>import tempfile
  import win32api
  import win32print
  import matplotlib.pyplot as plt
  
  filename = tempfile.mktemp (".txt")
  
  line = plt.plot((0, 24), (-10, -10), linestyle='--', color='red')
  
  open (filename, "w").write(line)
  
  win32api.ShellExecute (
    0,
    "print",
    filename,
    '/d:"%s"' % win32print.GetDefaultPrinter (),
    ".",
    0
  )
  </code></pre>