开发者

Cleaner looking TCL GUI TK Button

I have a Tk::Button that has a folder image on it. On some occasions we disable this button and the button image is kind of grayed out.

Example:

Cleaner looking TCL GUI TK Button

Cleaner looking TCL GUI TK Button

Is there anyway to clean up the disabled look? Possible bind a separate image to use when disabled?

set ::开发者_C百科FileSelect::folder_image [image create photo -file "$::env(Path)/include/images/folder.gif"]
set ::FileSelect::folder_image_disabled [image create photo -file "$::env(Path)/include/images/folder_disabled.gif"]
ttk::button $widget_name.browse -image { $::FileSelect::folder_image disabled $::FileSelect::folder_image_disabled }


You can change the bitmap in whatever code sets the state to the disabled state.

For example:

if [should_be_disabled] {
    button configure -state disabled -image $disabled_image
} else {
    button configure -state normal -image $normal_image

If you are using themed widgets you can specify different images for each state. For example, to use the image disabled_image for the disabled state and default_image for the normal state you would do something like this:

ttk::button .b1 -image {default_image disabled disabled_image}

For more information on the themed button see the man page for ttk::button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜