如何从很长的列表中填充 PyGTK TreeView?
在我的 PyGTK GUI 中,我从 ListStore 填充 TreeView。 ListStore 包含 3 个字符串字段,这些数据是从纯文本文件读入存储的。 TreeView 设置在 ScrolledWindow 中。该列表非常长,大约有 80K 行,这意味着我的 ListStore 列表将有 80K 项长。该程序需要很长时间才能填充 TreeView。有哪些技术可以避免将整个列表读入内存。我怎样才能逐步阅读它?在什么事件中我应该调用这个读入ListStore例程?
In my PyGTK GUI, I am populating a TreeView from a ListStore. The ListStore contains 3 string fields, and this data is read into the store from a plain text file. The TreeView is set in a ScrolledWindow. The list is very long, about 80K lines, which means my ListStore list will be 80K items long. The program takes a long time to populate the TreeView. What techniques are there to avoid reading into memory the whole list in its entirety. How can I read it in steps ? And on what event should I invoke this read-into-ListStore routine ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
PyGTK 常见问题中有一些关于加载长列表并在加载时保持 UI 响应。
There are some tips in the PyGTK FAQ about loading long lists and keeping your UI responsive while loading.