Help needed on how to print the whole content of wxframe

How can I print the entire content of wxframe?

Thanks,

Sunday Olutayo

That depends on what is in the frame. Printing is virtually the same as drawing, so if you can draw the contents of your frame using a wx.DC then you can reuse the same code when printing it. If the content of your frame is a bunch of widgets with values then you'll need to come up with some other way to represent the data that is conducive to printing.

There are some examples in the demo and in the books about the printing framework. There are also people on the wxPython-users mail list willing to help answer questions or to give you ideas, so you should join the list and send a message more fully describing your needs and see what they have to say.

···

On 12/4/12 8:33 AM, SUNDAY A. OLUTAYO wrote:

How can I print the entire content of wxframe?

--
Robin Dunn
Software Craftsman

Thanks for your response, the frame contain two panel:
one for listctrl and other for staticbox and textctrl

Thanks,

Sunday Olutayo

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: wxpython-users@googlegroups.com
Sent: Tuesday, December 4, 2012 7:29:36 PM
Subject: Re: [wxPython-users] Help needed on how to print the whole content of wxframe

On 12/4/12 8:33 AM, SUNDAY A. OLUTAYO wrote:

How can I print the entire content of wxframe?

That depends on what is in the frame. Printing is virtually the same as
drawing, so if you can draw the contents of your frame using a wx.DC
then you can reuse the same code when printing it. If the content of
your frame is a bunch of widgets with values then you'll need to come up
with some other way to represent the data that is conducive to printing.

There are some examples in the demo and in the books about the printing
framework. There are also people on the wxPython-users mail list
willing to help answer questions or to give you ideas, so you should
join the list and send a message more fully describing your needs and
see what they have to say.

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Weird. Somehow the original message in this thread ended up in my Inbox rather than my wxPython-users folder, so I assumed that it was sent to me directly. So obviously Sunday is already on this list and doesn't need to join, and has already asked a question here. Although some more details would be nice.

···

On 12/4/12 10:29 AM, Robin Dunn wrote:

There are some examples in the demo and in the books about the printing
framework. There are also people on the wxPython-users mail list
willing to help answer questions or to give you ideas, so you should
join the list and send a message more fully describing your needs and
see what they have to say.

--
Robin Dunn
Software Craftsman

In that case I recommend taking a look at the wx.html.HtmlEasyPrinting class. You can build a simple html document containing your data (such as using a <table> for your data in the listctrl, etc.) and then print it using the HtmlEasyPrinting class, and not have to deal with formatting and drawing each page yourself.

···

On 12/4/12 9:00 AM, SUNDAY A. OLUTAYO wrote:

Thanks for your response, the frame contain two panel:
one for listctrl and other for staticbox and textctrl

--
Robin Dunn
Software Craftsman

I will look at wxhtml

Thanks,

Sunday Olutayo

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: wxpython-users@googlegroups.com
Sent: Tuesday, December 4, 2012 7:49:06 PM
Subject: Re: [wxPython-users] Help needed on how to print the whole content of wxframe

On 12/4/12 9:00 AM, SUNDAY A. OLUTAYO wrote:

Thanks for your response, the frame contain two panel:
one for listctrl and other for staticbox and textctrl

In that case I recommend taking a look at the wx.html.HtmlEasyPrinting
class. You can build a simple html document containing your data (such
as using a <table> for your data in the listctrl, etc.) and then print
it using the HtmlEasyPrinting class, and not have to deal with
formatting and drawing each page yourself.

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I have used the following link with great success.
How to Take a Screenshot of Your wxPython App and Print it - Mouse Vs Python

In addition, I have used the python library PIL to scale any image deemed necessary.

Bruce

···

On Tuesday, December 4, 2012 5:52:52 PM UTC-5, Sunday Olutayo wrote:

I will look at wxhtml

Thanks,

Sunday Olutayo

----- Original Message -----

From: “Robin Dunn” ro...@alldunn.com

To: wxpytho...@googlegroups.com

Sent: Tuesday, December 4, 2012 7:49:06 PM

Subject: Re: [wxPython-users] Help needed on how to print the whole content of wxframe

On 12/4/12 9:00 AM, SUNDAY A. OLUTAYO wrote:

Thanks for your response, the frame contain two panel:

one for listctrl and other for staticbox and textctrl

In that case I recommend taking a look at the wx.html.HtmlEasyPrinting
class. You can build a simple html document containing your data (such
as using a

for your data in the listctrl, etc.) and then print
it using the HtmlEasyPrinting class, and not have to deal with
formatting and drawing each page yourself.


Robin Dunn

Software Craftsman

http://wxPython.org


To unsubscribe, send email to wxPython-user...@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Dear Robin,

I actually bought wxPython IN ACTION some years back from Amazon, I have
read through it and there is no example of wx.html displaying data from data base in it.

Please I will to know if it is possible to embed python code in the 'file' that is pass to Loadfile(file),
for example:

elem = [data0, data1, data2, data3]

for item in elem:
   <td> item </td>

Assuming that the elem is result of database query while the loop to
dynamically construct table

Thanks,

Sunday Olutayo

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: wxpython-users@googlegroups.com
Sent: Tuesday, December 4, 2012 7:49:06 PM
Subject: Re: [wxPython-users] Help needed on how to print the whole content of wxframe

On 12/4/12 9:00 AM, SUNDAY A. OLUTAYO wrote:

Thanks for your response, the frame contain two panel:
one for listctrl and other for staticbox and textctrl

In that case I recommend taking a look at the wx.html.HtmlEasyPrinting
class. You can build a simple html document containing your data (such
as using a <table> for your data in the listctrl, etc.) and then print
it using the HtmlEasyPrinting class, and not have to deal with
formatting and drawing each page yourself.

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Dear Robin,

I actually bought wxPython IN ACTION some years back from Amazon, I have
read through it and there is no example of wx.html displaying data from database in it.

Please I will to know if it is possible to embed python code in the 'file' that is pass to Loadfile(file),
for example:

elem = [data0, data1, data2, data3]

for item in elem:
   <td> item </td>

Assuming that the elem is result of database query while the loop to
dynamically construct table

Thanks,

Sunday Olutayo

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: wxpython-users@googlegroups.com
Sent: Tuesday, December 4, 2012 7:49:06 PM
Subject: Re: [wxPython-users] Help needed on how to print the whole content of wxframe

On 12/4/12 9:00 AM, SUNDAY A. OLUTAYO wrote:

Thanks for your response, the frame contain two panel:
one for listctrl and other for staticbox and textctrl

In that case I recommend taking a look at the wx.html.HtmlEasyPrinting
class. You can build a simple html document containing your data (such
as using a <table> for your data in the listctrl, etc.) and then print
it using the HtmlEasyPrinting class, and not have to deal with
formatting and drawing each page yourself.

--
Robin Dunn
Software Craftsman

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

SUNDAY A. OLUTAYO wrote:

Please I will to know if it is possible to embed python code in the 'file' that is pass to LoadFile(file),

No. That file must be 100% HTML.

To do what you are asking, you would need to read the file into Python,
do the substitutions yourself, and pass the resulting string to SetPage.

Here is a simple example:

----- sample.html ----
<html> <body>
<table> <tr>
%(table)s
</tr> </table>

---- handlePage.py ----
html = open('sample.html','r').read()
elem = ['aaa', 'bbb', 'ccc', 'ddd']
table =
for item in elem:
    table.append( '<td>%s</td>' % item )
page = html % (''.join(table))
htmlWindow.SetPage( page )
----- -----

The step that converts 'html' to 'page' is the "template substitution"
step. I've shown how to do simple substitutions using the Python %
operator, but you could also use one of the many templating systems for
that step, if appropriate.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Hi,

Tim Roberts, the example is lovely I appreciate you

Thanks,

Sunday Olutayo

···

----- Original Message -----
From: "Tim Roberts" <timr@probo.com>
To: wxpython-users@googlegroups.com
Sent: Wednesday, December 12, 2012 12:09:39 AM
Subject: Re: [wxPython-users] Help needed on how to print the whole content of wxframe

SUNDAY A. OLUTAYO wrote:

Please I will to know if it is possible to embed python code in the 'file' that is pass to LoadFile(file),

No. That file must be 100% HTML.

To do what you are asking, you would need to read the file into Python,
do the substitutions yourself, and pass the resulting string to SetPage.

Here is a simple example:

----- sample.html ----
<html> <body>
<table> <tr>
%(table)s
</tr> </table>

---- handlePage.py ----
html = open('sample.html','r').read()
elem = ['aaa', 'bbb', 'ccc', 'ddd']
table =
for item in elem:
    table.append( '<td>%s</td>' % item )
page = html % (''.join(table))
htmlWindow.SetPage( page )
----- -----

The step that converts 'html' to 'page' is the "template substitution"
step. I've shown how to do simple substitutions using the Python %
operator, but you could also use one of the many templating systems for
that step, if appropriate.

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en