如何解决Python Tkinter:从ttk.Combobox获得价值
我在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)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。