Username: Password:

Perl/TkFAQ-11.9.怎样获取画布的大小?调整了大小之后呢?
来源:linux宝库作者:linux宝库 发布时间:2007-09-30 00:00:00


  原文:

  11.9. How do I get the size of a Canvas? After a re-size? $canvas->cget(-width);

  simply returns the size of the canvas when it was created, whereas $canvas->Width;

  will get the answer even after a re-size. Substitute [Hh]eight for [Ww]idth in the above if that is what you want.

  Nick Ing-Simmons points out that if you want to have your Canvas be able to grow to arbitrarily large sizes be sure to specify the -expand or -fill options when you ->pack the Canvas.

  译文:

  11.9. 怎样获取画布的大小?调整了大小之后呢?

  $canvas -> cget(-width);

  只返回画布组件在创建时的宽度,而

  $canvas -> Width;

  则能够获取调整以后的画布大小。假如您需要的是高度数值,只要把上面的[Ww]idth替换成[Hh]eight就能够了。

  另外,Nick Ing-Simmons指出,假如您希望您的画布能够延伸到任意大小,那么必须在您使用->pack的时候指定-expand或-fill选项。

喜欢本文,那就收藏到:

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