wxPrintPreview - DatabaseGrid and wx.html.HtmlWindow

MrJanes wrote:

Hello everyone,

I struggle with the wxPrintPreview:

MY QUESTION 1:

I need a small help with the printing of a Database grid.

I'm working on a small database(pysqlite) application. I display a table from the database on a frame with an wx.grid table:

I would like to PrintPreview it and after that print everything on paper

[...]

I import and execute this from a main frame menu.

MY QUESTION 1:

I would like to add a printing support so that I can preview and print the Database Resluting Grid to paper.

__________________________________________________________________________________________

MY QUESTION 2:

I also have a wx.panel where a wx.html.HtmlWindow displays a html readme.html file.

A possible answer to both of your questions is to use wx.HtmlEasyPrinting. Generate a html table from the contents of the grid (or directly from the db query) and then pass it to wx.HtmlEasyPrinting for preview and printout. The readme.html file can be done directly.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

MrJanes wrote:

Robin Dunn wrote:

MrJanes wrote:

A possible answer to both of your questions is to use wx.HtmlEasyPrinting. Generate a html table from the contents of the grid (or directly from the db query) and then pass it to wx.HtmlEasyPrinting for preview and printout. The readme.html file can be done directly.

My Question: I would rather not like to output in html - I had the application as a WebApplication programmed and wanted to move away from html output - because of this I choose wxpython.

Is it NOT POSSIBLE at all - or just very difficult with the present wxpython?

If it's just very difficult - can someone at least point me in the right direction. especially with the : Database grid.

wx.HtmlEasyPrinting makes it easy, but it is still possible otherwise. You'll just have to decide how to draw your data to a DC and then implement it. That's how the PrintFramework works, you draw what is to be printed. See the demo for an example.

Thanks so much Robin:

It seems you are the only one who dare to anwser it: I really want to print it with the PrintFrame works - I checked the demo and can print text and so on.

I can also print a bit of the grid with the ScreenDC BUT I could not figure out how to print the whole grid result. I can draw some text or DrawRectangle to a panel and print it.

My Question: how can I have a frame unto which I put the GridResult:

class Frame_ResultDisplayGrid(wx.Frame):
....
       self.GridResultDisplay = wx.grid.Grid(parent = self,
                               id = -1,
                               pos = wx.Point(0, 0),
                               size = wx.Size(1024, 768),
                               style = 0,
                               name = wx.PanelNameStr)

       self.GridResultDisplay.CreateGrid(int(GridNumber), int(TotalNumberOfColumns))

Can I use one of this directly to draw and how would i specify it:

something:

dc.BeginDrawing()
dc.self.GridResultDisplay

thanks matthias janes

Fam.Janes wrote:

I can also print a bit of the grid with the ScreenDC BUT I could not figure out how to print the whole grid result. I can draw some text or DrawRectangle to a panel and print it.

My Question: how can I have a frame unto which I put the GridResult:

class Frame_ResultDisplayGrid(wx.Frame):
....
      self.GridResultDisplay = wx.grid.Grid(parent = self,
                              id = -1,
                              pos = wx.Point(0, 0),
                              size = wx.Size(1024, 768),
                              style = 0,
                              name = wx.PanelNameStr)

      self.GridResultDisplay.CreateGrid(int(GridNumber), int(TotalNumberOfColumns))

Can I use one of this directly to draw and how would i specify it:

No, you will have to draw all the lines and strings yourself as the grid doesn't have easy access for drawing itself to an external DC (such as for printing.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!