使用RadioButtons作为变量错误

时间:2018-08-02 18:03:09

标签: python pandas csv tkinter

这是我使用Tkinter来选择特定部门并查找与之相关的产品的示例代码。在我的代码下是csv文件外观的虚拟版本。

from tkinter import*
import pandas as pd 


root = Tk()

Department = StringVar()
Department.get()
Department.set("DepartmentA")

Radiobutton.config(textvariable=Department) 

Label(root, textvariable=Department).pack()

Radiobutton(root, text="DepartmentA", variable=Department, value="DepartmentA").pack()
Radiobutton(root, text="DepartmentB", variable=Department,value="DepartmentA").pack()
Radiobutton(root, text="DepartmentC", variable=Department, value="DepartmentA").pack()


fileread = pd.read_csv('50.csv', encoding='latin-1')
filevalue = fileread.loc[fileread['Customer'].str.contains(Department, na=False),"Product"]
root.mainloop()

这是一个虚拟的csv文件:

enter image description here

我在,但是出现以下错误:

   Radiobutton.config(textvariable=Department) 
TypeError: configure() missing 1 required positional argument: 'self'

我不确定为什么会收到此错误,而在StackOverFlow上遇到此错误的其他问题未能帮助解决此问题。根据所选的特定部门,对如何打印产品价值有任何想法吗?我不认为这是重复的问题,因为我不知道如何将变量专门链接到RadioButtons

0 个答案:

没有答案