The wxPython printing framework

This chapter covers

■ Printing in wxPython

■ Creating and displaying the print dialog

■ Creating and displaying the page setup dialog

■ Printing from your application

■ Performing a print preview

In chapter 16, we looked at one method of printing in wxPython—using wx.Html-EasyPrinting. This works fine if you are trying to print HTML (or something that can easily be converted to HTML), but is somewhat lacking as a complete printing solution. There is a more general printing framework in wxPython, which you can use to print anything and everything you want. Essentially, the wxPython framework allows you to draw your application to a printer, using device contexts and drawing operations. You can also create print previews that mimic your print display to the screen.

This chapter will cover the most important class in this framework, wx.Print-out, which manages the actual graphics component. The printout instance can be managed either by a wx.Printer object representing the printer or a wx.Print-Preview object allowing for a screen-based rendering of the printout. We'll also look at a few classes that manage printer-related data, and the standard dialog boxes you can use to present that information to the user.

Was this article helpful?

0 0

Post a comment