Grid, data and printing problem.

Hello wxPython users,

the default content is printed correctly but how

do i print the modified content of my grid.

I don’t understand how it works.

I have attached an example for whoever will help me.

Thanks your very much, this

example is for a wxPyWiki page.

test.py (43.8 KB)

Your code is calling CreatePrintData right after creation of the grid.
So the inital data is stored within the PrintGrid instance.

The simplest modification is to call CreatePrintData right before printing:

 def OnPrintPreview\(self, event\):
     self\.CreatePrintData\(\)
     self\.grdprt\.Preview\(\)

 def OnPrint\(self, event\):
     self\.CreatePrintData\(\)
     self\.grdprt\.Print\(\)

While this simple modification works, you should create the printing data structures only for printing and destroy them after printing again. There is no point in storing them permanently as self.grdprt

Regards,

Dietmar

···

On 6/17/2018 8:26 PM, Zig Zag wrote:

the default content is printed correctly but how
do i print the modified content of my grid.
I don't understand how it works.

Hello Dietmar,
I thank you for this quick and accurate answer.

Regards,
Zig zag