== Printing using a Report Generator == How to print information stored in a database from within a wxPython application (actually any Python app)? There are many solutions out there, but it seems to be a regular question and as I recently updated how I am doing it I thought this might be useful for others. I'll create a section for Report Manager (which is the Generator I use), maybe others can expand this with information on other Report Generator tools. === Report Manager === Report Manager is a pretty powerful report generator and you can find it at [[http://reportman.sourceforge.net/]]. There are different ways of integrating it with your Python application, I explain below just the option I have choosen. Besides Report Manager you will also need to get these: [[http://starship.python.net/crew/theller/ctypes/]] - Python 2.5 already includes the ctypes module [[http://groups.yahoo.com/group/reportman/files/PyReportManager-0.1.0.zip]] - a Python script wrappen ctypes and the Report Manager's ActiveX After you installed the above and create a report you only need a few lines of code to run your report. {{{ #!python # import the ActiveX wrapper code from reportman import ReportMan # define some values for report parameters # DRINKTYPE is used in the SQL where clause of the report and LANG defines what language to use (5 = German) params = (('DRINKTYPE_BEG', 1), ('DRINKTYPE_END', 2), ('LANG', 5)) report = ReportMan(r"yourreportfile.rep") for param in params: report.set_param(param[0], param[1]) report.preview('a title to be shown in the window title bar') }}} === Comments === Any comments are welcome, please feel free to just add them to this page, or you can also send them to me werner.bruhin at free.fr