【问题标题】:Running a function when button clicked, not on released单击按钮时运行功能,而不是释放时
【发布时间】:2015-04-21 05:50:38
【问题描述】:

当我们使用 tkinter 时,按钮会在我们单击并释放按钮后调用该函数。点击按钮时如何调用函数

【问题讨论】:

  • 请显示您尝试过的代码?

标签: python button tkinter


【解决方案1】:

通过绑定<Button-[1|2|3]> 事件可以将鼠标点击绑定到按钮:myButton.bind("<Button-1>", myfunc)。绑定<ButtonRelease-1> 将在释放按钮时调用绑定函数。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-01
    • 1970-01-01
    • 2021-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多