10.7. How do I get a PostScript(c) output of a Canvas w/ widgets?

In general you don't. You can't do it in Tcl/Tk either (if that is any consolation). Nick Ing-Simmons posted an explicit discussion of what is involved:


Subj: RE: Canvases and postscript output

On Tue, 28 Nov 95 14:37:09 PST
Davis <morry@dsg.tandem.com> writes:
! I have a canvas with text and some entry widgets that I want to create
!postscript from. I used the 
!widget->postscript( -file => 'ld.ps', -colormode  => 'gray');
!the file gets created but its empty. Is there some other options I need?
Core Tk cannot write postscript for embedded windows, the best it could do would be to grab a Pixmap of the window as displayed. This is fine if the window is visible, but if it is scrolled off screen or under another application there is no pixmap.

Only complete fix is to have a ->postscript method for every possible widget which can render un-mapped widgets. This is non-trivial task.


!Also I have a scrollbar for this canvas and when I scroll  the entry widget
!actually scroll part way out of the frame the canvas is in. Why does this
!happen and can I fix it? 
The Entry widgets need to be descendants of the canvas or they just get clipped to their parent.

Previous | Return to table of contents | Next