Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
作为一个非常简单的示例,假设我有一个按钮,并且每次单击该按钮时,我都希望它调用不同的回调。因此,它首先设置为调用 hello(),然后 hello() 进行更改,以便下次单击按钮时调用 world()。
实时调频!!!
事实证明,小部件的任何属性都可以使用“配置”方法进行更改:
... $btn = $frame->$new_ttk__button(-text => "hello", -command => \&say_hello()); Tkx::MainLoop(); sub somefunc_invoked_by_some_other_button { $btn->configure(-text => "goodbye", -command => \&say_bye()); }