我知道“切换或未切换”事件不存在,但我需要使用这样的事件。当按钮“切换”和“未切换”时是否有执行任务的事件。我不想使用“clicked”事件,因为 ToggleButton 可以在不单击的情况下切换或取消切换 谢谢
示例
def foo(obj):
if obj.get_active():
print("toggled")
else:
print("untoggled")
mybtn = gtk.ToggleButton()
mybtn.connect("toggled-or-untoggled", foo)
最佳答案
根据the docs -
When the state of the button is changed, the “toggled” signal is emitted.
因此,理想情况下,mybtn.connect("toggled", foo)
应该可以工作。
关于python - PyGtk3,切换按钮, "toggled-or-untoggled"事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43436021/