有没有办法获取 Tcl 分发默认提供的位图图像列表?
我找到了一个与这个问题相关的 wiki 页面 http://wiki.tcl.tk/1419 但它使用了已经准备好的位图列表
Bitmap images (as opposed to bitmaps, which you should avoid if you can) are images created with image create bitmap
, and may be listed by filtering image names
with the assistance of image type
:
proc listBitmapImages {} {
set bitmaps {}
foreach im [image names] {
if {[image type $im] eq "bitmap"} {
lappend bitmaps $im
}
}
return $bitmaps
}
Note that Tk creates no bitmap images by default. (There are some default bitmaps, as listed on the Tk_GetBitmap
manual page, but they're not otherwise discoverable and ought to be avoided in new code if at all possible. Their portability is also very dodgy in the first place, and the main thing you might choose to use them for — stippling of canvas items — is one of the things that isn't actually portable.)
从您引用的 wiki 页面开始,相关命令是
.c
画布小部件在哪里。
canvas
手册页说明了子命令的-bitmap
选项create bitmap
:
指定位图以正常、活动和禁用状态显示在项目中。位图可以具有Tk_GetBitmap接受的任何形式。
Tk_GetBitmap 手册页列出了内置位图。
我还看到了显示默认位图如何实例化的源代码。generic/tkBitmap.c
这些都不能帮助推断如何以编程方式列出内置位图。