Kivy ListView刷新(Kivy ListView refresh)
你好我有一个列表视图,我想用它作为记录器。 我试着做这个约会
ListView: id: x item_strings: [] x.item_string.appned(‘frank’) or ListView: id: x adapter: sla.SimpleListAdapter(data=[], cls=label.Label) x.adapter.data.append(‘frank’)这样可行。 但是在整个Job完成后,我在列表中看到了1000行。 但我希望看到在插入数组后,该值应该直接显示在视图中。
我在一次插入或类似的东西之后看过一种List View茶点,但我找不到一些
任何想法。
谢谢
坦率
Hallo I’ve a List View and I want to use it as a Logger. I’ve try to do this Job with
ListView: id: x item_strings: [] x.item_string.appned(‘frank’) or ListView: id: x adapter: sla.SimpleListAdapter(data=[], cls=label.Label) x.adapter.data.append(‘frank’)That works. But I see 1000 Rows in the list after the whole Job is done. But I want to see that after one insert into the array the value should be show directly in the view.
I’ve watched for a kind of List View refreshment after one insert or something like this but I couldn't find some
Any Idea.
Thanks
Frank
最满意答案
您可能从文档中了解到,ListView API目前仍处于构建和实验阶段。 在您的情况下可能有用的是在追加项目后立即调用私有且因此未记录的ListView方法_trigger_reset_populate():
x.adapter.data.append(‘frank’) x._trigger_reset_populate()The Key is multithreading.
ListView: id: logger adapter: sla.SimpleListAdapter(data=[], cls=label.Label) def logger(self, logger): for counter in range(0, 1000): logger.item_string.insert(0, str(counter) + ' log entry') thread.start_new_thread(logger, (self.logger))That works fine.
更多推荐
发布评论