Kivy ListView刷新(Kivy ListView refresh)

编程入门 行业动态 更新时间:2024-10-22 11:01:25
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.

更多推荐

本文发布于:2023-08-07 20:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465559.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Kivy   ListView   refresh

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!