Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. def printer(self):
  2. "Prints the current diagram"
  3. # Create the printer
  4. printerobject = QtGui.QPrinter(0)
  5. # Set the settings
  6. printdialog = QtGui.QPrintDialog(printerobject)
  7. if printdialog.exec_() == QtGui.QDialog.Accepted:
  8. # Print
  9. pixmapImage = QtGui.QPixmap.grabWidget(self.contentswidget)
  10. painter = QtGui.QPainter(printerobject)
  11. painter.drawPixmap(0, 0, pixmapImage)
  12.  
  13. def printer(self):
  14. "Prints the current diagram"
  15. # Create the printer
  16. printerobject = QtGui.QPrinter(0)
  17. # Set the settings
  18. printdialog = QtGui.QPrintDialog(printerobject)
  19. if printdialog.exec_() == QtGui.QDialog.Accepted:
  20. # Print
  21. pixmapImage = QtGui.QPixmap.grabWidget(self.contentswidget)
  22. painter = QtGui.QPainter(printerobject)
  23. painter.drawPixmap(0, 0, pixmapImage)
  24. del painter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement