html - Python Qt: Qprinter not defined -
I am trying to run the printer output from the HTML document.
Here's one small function to do this:
def callPrinterHtml (auto, document): self.printer = QPrinter () self.printer.setPageSize (QPrinter. Letter dialog = QPrintDialog (self.printer, self) if dialog.exec_ (): document.print_ (self.printer)
Although the message is pop up:
self.printer = QPrinter () Name Error: Global Name 'QPrinter' is not defined
The printer is clearly inside the definition definition function. So, what am I missing here?
All comments and suggestions are highly appreciated.
-
Did you import the module that contains the QPrinter? Using an Import Directive?
-
Is the QPrinter containing the module in your dragon path?
Comments
Post a Comment