title: Python Qt: Qprinter not defined
body: <p>I am trying to put the printer to run the output from an html document.</p>
  
  <p>Here is a small function to do that:</p>
  
  <pre><code>def callPrinterHtml(self,document):
      self.printer = QPrinter()
      self.printer.setPageSize(QPrinter.Letter)
  
      dialog = QPrintDialog(self.printer, self)
      if dialog.exec_():
          document.print_(self.printer)
  </code></pre>
  
  <p>However the message pops up: </p>
  
  <pre><code>self.printer = QPrinter()
  NameError: global name 'QPrinter' is not defined
  </code></pre>
  
  <p>The printer definition is clearly inside the function. So, what am I missing here?</p>
  
  <p>All comments and suggestions are highly appreciated.</p>