Python 3.x 组合框值显示为单个字符串字符

Python 3.x 组合框值显示为单个字符串字符,python-3.x,tkinter,Python 3.x,Tkinter,我在论坛上发布了一个新帖子&利用python/tkinter创建一个电子表单来收集制造车间的问题 我有一(2)个组合框 第一个组合框从给定的dictionary.keys()中获取其“值”,该dictionary.keys()更新第二个组合框的“值”。但是,在为第一个组合框选择值之后为第二个组合框选择值时,这些值仅显示dictionary.values()中的单数字符 下面是txt文件中的列表。每行上的第一项是键,而同一行上的其余项是其值 Bondshop, Plies: Layup Diffi

我在论坛上发布了一个新帖子&利用python/tkinter创建一个电子表单来收集制造车间的问题

我有一(2)个组合框

第一个组合框从给定的dictionary.keys()中获取其“值”,该dictionary.keys()更新第二个组合框的“值”。但是,在为第一个组合框选择值之后为第二个组合框选择值时,这些值仅显示dictionary.values()中的单数字符

下面是txt文件中的列表。每行上的第一项是键,而同一行上的其余项是其值

Bondshop, Plies: Layup Difficulty, Plies: Cutting Edge
IB Postbond, POU, Equipment, Inspection, Available Work Space, Big Paint, 1575, QN
General Postbond, Inspection
Seal Area, Inspection
Big Paint, Inspection
Deflash, Inspection
为什么我的第二个组合框是这样显示的?见下文

==snip===
def装载类别(自身):
#从dictCategory.txt文件读取生产区域和目录
self.textfileCategory=open('dictCategory.txt','r')
self.lines\u category=self.textfileCategory.readlines()
对于self.lines\u类别中的行:
splitLine=line.split(',')
dict_category[str(分割线[0])]=“,”。join(分割线[1:]))
self.textfileCategory.close()
==剪断===
def UpdateData(自身、事件):
#根据生产区域选择更新类别组合框
self.menu_category.set('--'))
category=self.menu\u production\u area.get()
self.menu_category['values']=已排序(dict_category[category])
==剪断===
self.menu\u production\u area=ttk.Combobox(主框架,state='readonly',value=sorted(列表(dict\u category.keys()),宽度=25)
self.menu\u production\u area.bind(“”,self.UpdateData)
self.menu\u production\u area.grid(行=2,列=1,sticky='w')
请阅读“完成”意味着所需的玩具数据在代码中,而不是只有您才能看到的文件中。换句话说,将文本中的
load_category
替换为
dict_category
。您可能会发现问题在于文件或load_category如何转换文件。
===snip===
    def loadcategory(self):

         # Reads production areas & cateogries from dictCategory.txt file
         self.textfileCategory = open('dictCategory.txt', 'r')
         self.lines_category = self.textfileCategory.readlines()
         for line in self.lines_category:
             splitLine = line.split(',')
             dict_category[str(splitLine[0])] = ",".join(splitLine[1:])
         self.textfileCategory.close()

===snip===  

    def UpdateData(self, event):

        # Updates Category Combobox based on Production Area selection
        self.menu_category.set('---')
        category = self.menu_production_area.get()
        self.menu_category['values'] = sorted(dict_category[category])

===snip===

    self.menu_production_area = ttk.Combobox(Main_Frame, state='readonly', values = sorted(list(dict_category.keys())), width=25)
    self.menu_production_area.bind('<<ComboboxSelected>>', self.UpdateData)
    self.menu_production_area.grid(row=2, column=1, sticky='w')