Print a widget

Hi all

I am using the gizmos TreeListCtrl to display a tree.

Is there any way to print the current view of this tree to PDF, printer or any other format?

Thanks

David

Programmatically take a screenshot (adjust the filename logic):

  def __save_screenshot_to_file(self, filename=None):

    time.sleep(0.5)

    rect = self.GetRect()

    # adjust for window decoration on Linux
    if sys.platform == 'linux2':
      client_x, client_y = self.ClientToScreen((0, 0))
      border_width = client_x - rect.x
      title_bar_height = client_y - rect.y
      # If the window has a menu bar, remove it from the title bar height.
      if self.GetMenuBar():
        title_bar_height /= 2
      rect.width += (border_width * 2)
      rect.height += title_bar_height + border_width

    scr_dc = wx.ScreenDC()
    mem_dc = wx.MemoryDC()
    img = wx.EmptyBitmap(rect.width, rect.height)
    mem_dc.SelectObject(img)
    mem_dc.Blit ( # copy ...
      0, 0, # ... to here in the target ...
      rect.width, rect.height, # ... that much from ...
      scr_dc, # ... the source ...
      rect.x, rect.y # ... starting here
    )

    if filename is None:
      filename = gmTools.get_unique_filename (
        prefix = u'gm-screenshot-%s-' % pyDT.datetime.now().strftime('%Y-%m-%d_%H-%M-%S'),
        suffix = u'.png'
      )

    img.SaveFile(filename, wx.BITMAP_TYPE_PNG)
    gmDispatcher.send(signal = 'statustext', msg = _('Saved screenshot to file [%s].') % filename)

    return filename

Karsten

ยทยทยท

On Wed, Dec 02, 2015 at 02:23:12AM -0800, David Wende wrote:

I am using the gizmos TreeListCtrl to display a tree.

Is there any way to print the current view of this tree to PDF, printer or
any other format?

--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346