Ali Mezgani
Ali Mezgani

Reputation: 1249

How to Append data to a combobox

I need to insert data to a combobox so i do an append as defined in this lines :


fd = open(files,'rb')
data=fd.readlines()
for i in data[]: item=i.strip() if item is not None: combobox.Append(item) fd.close
Even data insert the selection still void please can you tell me how to set a selection a value from the items read. as like as selection contain first element

Upvotes: 0

Views: 1871

Answers (2)

Steven Sproat
Steven Sproat

Reputation: 4578

combobox.SetSelection(0)  # select first item

Upvotes: 1

delete
delete

Reputation:

I know this probably doesn't answer your question, but I recommend you close the file connection once you're done using it.

fd = open(files,'rb')
data=fd.readlines()

#Close the connection, you're done using it!
fd.close

#Now do what you want with data.
for i in data[]:
    item=i.strip()
    if item is not None:
       combobox.Append(item)

Upvotes: 0

Related Questions