问题描述
我在sqlite DB(employee_position)中有职位数据。同样,它正在获取该位置的数据:
self.employee_position =员工信息[0] [8]
但是,我无法插入数据。如何将数据插入组合框?
它确实适用于其他字段,例如Entry:
#Entry
self.email_entry.insert(0,self.employee_email)
self.email_entry.config(state = 'disabled')
# Position
self.available = self.employee_position
self.position_lbl = Label(self.centerFrame,text = 'Position:',fg = '#b3b3b3',bg = '#121212')
self.position_lbl.grid(row = 7,column = 0,sticky = W,columnspan = 2,padx = 5)
self.position = ttk.ComboBox(self.centerFrame,values=self.available,width = 27)
self.position.config(state = 'disabled')
self.position.grid(row = 7,column = 1,pady = 5)
解决方法
解决方案: #位置
self.available = [self.employee_position]
self.position_lbl = Label(self.centerFrame,text = 'Position:',fg = '#b3b3b3',bg = '#121212')
self.position_lbl.grid(row = 7,column = 0,sticky = W,columnspan = 2,padx = 5)
self.position = ttk.Combobox(self.centerFrame,values=(self.available),width = 27)
self.position.set(self.employee_position)
self.position.config(state = 'disabled')
self.position.grid(row = 7,column = 1,pady = 5)