该功能buttons_logic每1秒循环执行一次,而我没有按下按钮,我做错了什么?当我尝试自己按键时,该功能也被执行
# -*- coding: utf-8 -*-
from Tkinter import *
root = Tk()
def buttons_logic():
print('buttons_logic')
widget_var = Button(root, bg = "green4",\
fg = "white", font = "Arial 9 bold", \
width = 8, text = 'вкл\выкл',\
command = buttons_logic)
widget_var.pack(padx = 1, pady = 1, side = LEFT)
root.mainloop()


我已经安装了python 2.7.15,并且虚拟环境
virtualenv,脚本运行了它,最初出现一个错误,通过向文件中This probably means that Tcl wasn't installed properly.添加一个变量来修复错误,但这也没有解决这个问题,最后它帮助了不是通过参数调用按钮点击处理函数,而是通过函数调用set "TCL_LIBRARY=c:\Miscellanea\Programmig\Programming-Python\Python_2.7\tcl\tcl8.5"activate.batcommandbind