开发者

How to Append data to a combobox

开发者 https://www.devze.com 2023-01-21 10:31 出处:网络
I need to insert data to a combobox so i do an append as defined in this lines : fd = open(files,\'rb\')

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 con开发者_StackOverflow社区tain first element


combobox.SetSelection(0)  # select first item


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)
0

精彩评论

暂无评论...
验证码 换一张
取 消