英文:
TCL/TK widget::dateentry textvariable problem. When I change the text variable the widget does not change
问题
以下是您要翻译的部分:
我有这个简单的TCL/TK代码来测试日期选择小部件。如果我单击小部件,我可以更改日期值,并且小部件会正确更新。然而,当我想要将启动值设置为其他小部件时,小部件根本不会更新。
从Wish控制台执行以下代码对小部件没有任何影响:
set ::START_DATE 01/01/2023
set ::END_DATE 31/12/2023
变量值已更改,但小部件没有。两个小部件仍然显示今天的日期。请问有人可以帮助我如何设置textvariable START_DATE 和 END_DATE,以便小部件按预期更新?
谢谢
Daniel
英文:
I have this simple TCL/TK code to test date picker widget. If I click the widget I can change the date value and widget is updated correctly. However, when I want to set a start-up value to something else widget is not updated at all.
package require widget::dateentry
console show
set ::DATE ""
set start [widget::dateentry .s -textvariable ::START_DATE -dateformat "%d/%m/%Y" -firstday sunday]
set end [widget::dateentry .e -textvariable ::END_DATE -dateformat "%d/%m/%Y" -firstday sunday]
grid [label .sl -text "Start:"] $start -padx 4 -pady 4
grid [label .el -text "End:" ] $end -padx 4 -pady 4
set ::START_DATE 01/01/2023
set ::END_DATE 31/12/2023
Executing the following code from the wish console does not have any effect on the widget:
set ::START_DATE 01/01/2023
set ::END_DATE 31/12/2023
Variable value changed, however widget does NOT. Both widgets still show today's date. Please can someone help how to set textvariable START_DATE and END_DATE see the widget updated as expected?
Thank you
Daniel
答案1
得分: 1
这似乎是在我查看源代码时完全未实现的功能;在该代码中没有调用trace add variable
,-textvariable
选项的内容也没有传递给其他可能的地方。我认为这很令人惊讶,是一个错误。我已经关于这个问题提交了这个问题。
英文:
It appears to be an entirely unimplemented feature when I look through the source; there are no calls to trace add variable
in that code, nor is the contents of the -textvariable
option passed to anything else likely-looking. I think this is surprising and a bug. I've filed this issue about it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论