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选项。
|
还没有关于此文章的相关评论!