如何禁用 ttk::notebook 中的特定选项卡 [英] How to disable specific tab in ttk::notebook

查看:46
本文介绍了如何禁用 ttk::notebook 中的特定选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户选择另一个选项卡时,需要禁用特定选项卡.我无法使用以下代码实现它.

Need to disable particular tab, when user select the other one. I am not able to achieve it using following code.

选项卡仍保持启用状态.也试过 configure -state disabled 但抛出错误.

Tab still remains enabled. also tried configure -state disabled but throwing error.

ttk::notebook .top.d -padding 5
ttk::frame .top.d.f1;
ttk::frame .top.d.f2;
.top.d add .top.d.f2 -text "East" -padding 5
.top.d add .top.d.f1 -text "West" -padding 5
.top.d select .top.d.f1
ttk::notebook::enableTraversal .top.d
.top.d index .top.d.f2
##set vf [ttk::frame .top.d.f1]
bind .top.d <<NotebookTabChanged>> {
    if {[.top.d select] == ".top.d.f2"} {
        set flag 2
        .top.d.f1  state disabled
        puts $flag
    }
}

请建议正确的语法.

推荐答案

尝试

.top.d tab .top.d.f1 -state disabled

(路径名是标识选项卡的一种方式;也可以使用索引号.)

(The path name is one of the ways to identify a tab; index number could be used as well.)

文档:ttk::notebook

这篇关于如何禁用 ttk::notebook 中的特定选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆