How to update values to the listbox under Combobox in ttk Python33

前端 未结 1 600
-上瘾入骨i
-上瘾入骨i 2021-02-03 14:37

When I create the Combobox, it has no items in the list. Now when I click on the dropdown button a function is called (via the postcommand option), but once in my function I don

1条回答
  •  死守一世寂寞
    2021-02-03 15:34

    Answered my own question.

    I Finally found an example that helped, and got it to work with the following code:

    #update list upon drop down
    self.cbox = Combobox(self, width = 10, postcommand = self.updtcblist)
    
    def updtcblist(self):
        list = self.getPortLst()
        self.cbox['values'] = list
    

    This works as desired.

    0 讨论(0)
提交回复
热议问题