![](/img/trans.png)
[英]How do I bind the ListBox of a ComboBox in Python Tkinter
[英]how do i load json file names (without extension) into a listbox and into a combobox (python)?
我需要從文件夾中導入 json 文件作為列表框中的項目,然后是組合框。 我嘗試將文件加載到列表框中:
path_to_json = './'
json_files = [pos_json for pos_json in os.listdir(path_to_json) if pos_json.endswith('.json')]
self.profiles_print(json_files)
我可以將文件加載到列表框中,但它們都作為 1 項加載在一行中。
我怎樣才能使它成為單獨的項目?
謝謝,多姆
從其他來源回答:
path_to_json = './'
json_files = [pos_json for pos_json in os.listdir(path_to_json) if pos_json.endswith('.json')]
for i in json_files:
self.profiles_print(i)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.