Username: Password:

Perl/TkFAQ-11.8.怎样把画布中的窗口组件输出成PostScript?
来源:linux宝库作者:linux宝库 发布时间:2007-09-30 00:00:00


  原文:

  11.8. 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 outputOn Tue, 28 Nov 95 14:37:09 PSTDavis 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.

  译文:

  11.8. 怎样把画布中的窗口组件输出成PostScript?

  一般来说,这样是不能够的。Tcl/Tk也不能做到这一点(是否这样您会觉得安慰一些?:P)。作者Nick Ing-Simmons在下面的帖子里周详讨论了这个问题:

  主题:回复:画布和postscript输出

  On Tue, 28 Nov 95 14:37:09 PST

  Davis写到:

  !我配置了一个画布,里面包含了一些文字和输入框组件,我想把他们输出成postscript。

  !我用了如下的命令:$widget->postscript( -file => ’ld.ps’, -colormode => ’gray’);

  !输出文档是有的,但是里面是空的!我还需要什么其他的选项吗?

  核心的Tk不能把内嵌的窗口输出成postscript,最多也就是把窗口显示的部分抓成图片。这样在窗口是可见的情况下当然没有问题,但是假如他滚动出了屏幕或是被其他组件遮住,那么就不能生产图片了。

  唯一完全解决的方法是给每一个可能的组件都加上->postscript方法,但这可是个不小的工作……

  (译者注:这个问题我没有太看懂,只能是半猜测的翻译出来的,所以假如我理解的有问题,请大家指正!另外,后面的几句话我实在有些看不明白,所以就不翻了……L)

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅