[wxPython] Problem printing html with widgets

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] Problem printing html with widgets

Roger Young-3
Hi,

I have a problem with printing html when it contains wx Buttons etc.  
I am using wxPython 2.1.11 It leads to an access violation under
Windows NT. Also, I get the same error when attempting to print the
html window with widgets.  I tried searching in the archives and a
similar problem is mentioned by

> Werner Fouche [hidden email]
>Mon, 15 Nov 1999 19:17:28 -0500 .

>2: (Severe error) Select "Overview \ Non-Managed Windows \ =
>wxHTMLWindow". Click on "With Widgets", now click on "Print". The =
>"Print" dialog will appear. Click "OK". The application crashes with
>a= dialog headed "Printing pythonw.exe - Application Error". The
>text =contained in this dialog reads "The instruction at 0x00928841
>referenced = memory at 0x00000000. The memory could not be read".
>Note that if  "Show = Default" is selected and printed, a
>fine-looking printed document is = produced.

The access violation I get is not precisely what Werner reports.
Robin said the following about Werner's problem

>Thanks for the info.  Neither of these suprises me, but obviously I
>didn't think to test them.

May I ask whether this problem has been solved in further interim
releases of wxPython? At the moment I have an application in which I
am using wxPython to provide me with my lecture `slides' (including
interactive ones) for my philosophy of science class.  The students
have access to the application and can print off copies of my
straightforward` slides', but they cannot print `slides'  that have
buttons etc. embedded in them.

Yours,
Roger Young



Roger Young,
Philosophy Department,
University of Dundee
[hidden email]
tel 01382 344539

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Problem printing html with widgets

Robin Dunn
> May I ask whether this problem has been solved in further interim
> releases of wxPython? At the moment I have an application in which I
> am using wxPython to provide me with my lecture `slides' (including
> interactive ones) for my philosophy of science class.  The students
> have access to the application and can print off copies of my
> straightforward` slides', but they cannot print `slides'  that have
> buttons etc. embedded in them.
>

Here is a fix.  In lib/wxpTag.py at the end of the HandlWxpTag change the
code to look like this:

        # create the object
        parent = self.GetParser().GetWindow()
        if parent:
            obj = apply(self.ctx.classObj,
                        (parent,),
                        self.ctx.kwargs)
            obj.Show(true)

            # add it to the HtmlWindow
            self.GetParser().GetContainer().InsertCell(wxHtmlWidgetCell(obj,
                                                       self.ctx.floatWidth))
            self.ctx = None

        return true

This will simply ignore the widgets when printing.  A better solution of
course would be to create an image of the widget and substitute that for the
widget when printing, but that's a non-trivial task since any arbitrary
window class can be used here...

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users