print error in wxpython

9 views
Skip to first unread message

Jürgen Kareta

unread,
Nov 2, 2009, 1:16:10 PM11/2/09
to wx-u...@googlegroups.com

Hello,

I'm a regular user of wxpython and have a problem with the print
framework. As nobody on the wxpython ml could help I got the
recommendation to ask here again:

I have some trouble printing a page in some cases. While it works as
expected on my own machine, either running the source or using the compiled version
(with py2exe) it won't work on a other machine (XP SP3). On this PC I use the
same compiled version and the print preview looks fine, but I get a C++
Exception and the printer puts out a empty paper sheet on printing.

The exception is:
File "wx\_windows.pyo", line 4482, in GetDC
wx._core.PyAssertionError: C++ assertion "(int)devMode->dmMediaType !=
wxPRINTMEDIA_DEFAULT" failed at ..\..\src\msw\printdlg.cpp(204) in
wxWindowsPrintNativeData::TransferTo()

Printer initialization on app start:
def _PrinterSetup(self):
# initialize the print data and set some default values
self.pdata = wx.PrintData()
self.pdata.SetPaperId(wx.PAPER_A4)
self.pdata.SetOrientation(wx.PORTRAIT)
self.pdata.SetPrintMode(wx.PRINT_MODE_PRINTER)
self.margins = (wx.Point(0,0), wx.Point(0,0))


WxPython 2.8.7.1, Python 2.5.2
The problem might by that on this machine wxPRINTMEDIA_DEFAULT isn't
set, but on my machine it is - possibly during the wxpython installation. But this
isn't the first print app I roll out this way. So I have no idea how to go on with
this.
Some hints ?

Regards,
Jürgen



Reply all
Reply to author
Forward
0 new messages