-2

I just want to know howmany items are there in a ttk combobox, this I want to use

to do the For Loop, somebody please tell me how to do this. I am getting error out

of my code, somebody please note my code and help me

def WriteComboBoxValues(cls_Obj1): 

    for P in cls_Obj1.boxWidget["Combo1"]:

        txtData=str(cls_Obj1.boxWidget["Combo1"]['values'][P])+"\n" 

    print txtData += "\n" 
John R
  • 119
  • 1
  • 4
  • 14
  • What error?! At the very least, provide the traceback. – jonrsharpe Aug 06 '14 at 07:54
  • @jonrsharpe, appriciate for responding, please note the error Exception in Tkinter callback Traceback (most recent call last): for P in cls_Obj1.boxWidget["Combo1"]: File "C:\Python26\lib\lib-tk\Tkinter.py", line 1206, in cget return self.tk.call(self._w, 'cget', '-' + key) TypeError: cannot concatenate 'str' and 'int' objects – John R Aug 06 '14 at 09:08
  • At-least how to know the count of a combo box widget values, say for example if one combo box contains 4 items, how can I write a code statement to get this count. Something like this DataCount=cls_Obj1.boxWidget["Combo1"].count, this should return a value 4, somebody please help me soon – John R Aug 06 '14 at 09:38

1 Answers1

1
how_many = len(combobox.cget('values'))
Oblivion
  • 1,669
  • 14
  • 14