title: How to print directly without showing print dialog using python script in windows?
body: <p>I've created a desktop application to print a token from a printer, using <strong>python2.7</strong> and <strong>gtk+3</strong> in <strong>Windows</strong> OS. A button in my application should invoke a print from the file. For formatting the print I've used a <strong>.rtf</strong> file, opens the corresponding text editor (in my case MS Word) before printing the file out of the printer and then immediately closes.</p>
  
  <p>How I can avoid it opening and closing before it prints? Whether it's with MS Word settings, Windows or a solution in Python.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>def make_print(self):
      os.startfile("print.rtf", "print")
  </code></pre>
  
  <p>Note "<strong>print.rtf</strong>" is created by a python script prior to this call.</p>
  
  <p>I also tried this, but it isn't even printing.</p>
  
  <pre><code>def make_print1(self):
      with open('print.rtf', 'r') as f, open('LPT1:', 'w') as lpt:
          while True:
              buf = f.read()
              if not buf: break
              lpt.write(buf)
  </code></pre>