Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python tkinter中的bind()不返回预期值_Python_User Interface_Tkinter - Fatal编程技术网

Python tkinter中的bind()不返回预期值

Python tkinter中的bind()不返回预期值,python,user-interface,tkinter,Python,User Interface,Tkinter,我正在尝试在spinbox上传递带有tkinterbind()事件的变量。调试时,我发现我未能将变量传递给spinboxbind()事件处理程序函数。实际上,我的处理程序函数puteventqueue()的print var行打印0(默认spinbox值),而不管spinbox显示的值是多少 任何关于如何纠正我的错误的想法都欢迎!我一定是犯了个明显的错误,但我已经找了好几个小时了 spinbox事件处理程序函数: def puteventqueue(var): print 'spinbo

我正在尝试在spinbox上传递带有tkinter
bind()
事件的变量。调试时,我发现我未能将变量传递给spinbox
bind()
事件处理程序函数。实际上,我的处理程序函数
puteventqueue()
print var
行打印0(默认spinbox值),而不管spinbox显示的值是多少

任何关于如何纠正我的错误的想法都欢迎!我一定是犯了个明显的错误,但我已经找了好几个小时了

spinbox事件处理程序函数:

def puteventqueue(var):
    print 'spinbox has been clicked'
    print var
spinbox定义:

#spinboxes for color filters
spinval = tk.IntVar()
s = tk.Spinbox(root, from_=0, to=180, textvariable=spinval, increment=5)
filters = spinval.get()
s.grid(column=3, row=0)
s.bind('<Button-1>', lambda event: puteventqueue(filters))
#用于滤色器的旋转框
spinval=tk.IntVar()
s=tk.Spinbox(根,从0到180,textvariable=spinval,增量=5)
filters=spinval.get()
s、 网格(列=3,行=0)
s、 绑定(“”,lambda事件:puteventqueue(筛选器))

因为过滤器已设置为0,并且从未更改

请尝试以下操作:

 s.bind('<Button-1>', lambda event: puteventqueue(spinval.get()))
s.bind(“”,lambda事件:puteventqueue(spinval.get()))