I'm working my way through Chapter 17 of the Rappin & Dunn book on
printing. When I want to print database records retrieved from a sqlite3
database (via pysqlite2), do I display the record selection dialog and issue
the SQL select calls within the OnPreparePrinting() method?
Rather than have the page and printer setup dialogs called from a menu, as
they are in the example code, I'd rather put buttons to call them in the
same dialog box as the record selector. But, I'm not certain where in the
process this should all happen.
Rich
···
--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc.(TM) | Accelerator
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863
I'm working my way through Chapter 17 of the Rappin & Dunn book on
printing. When I want to print database records retrieved from a sqlite3
database (via pysqlite2), do I display the record selection dialog and issue
the SQL select calls within the OnPreparePrinting() method?
It probably depends on the nature of your database, the structure of your program, or whatever makes the most sense for you. If you already have the data loaded for display then there is no need to fetch it from the DB again for printing. Otherwise you can get it whenever you need it, such as before you start printing or as you print each page.
Rather than have the page and printer setup dialogs called from a menu, as
they are in the example code, I'd rather put buttons to call them in the
same dialog box as the record selector. But, I'm not certain where in the
process this should all happen.
Just put the buttons wherever you want them in your UI, and then hook up the event handlers using wx.EVT_BUTTON instead of wx.EVT_MENU.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!