Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Kivy ListView刷新_Python_Listview_Kivy - Fatal编程技术网

Python Kivy ListView刷新

Python Kivy ListView刷新,python,listview,kivy,Python,Listview,Kivy,你好,我有一个列表视图,我想用它作为一个记录器。 我已经试着和你一起做这项工作了 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’) 这很有效。但在整个

你好,我有一个列表视图,我想用它作为一个记录器。 我已经试着和你一起做这项工作了

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’)
这很有效。但在整个工作完成后,我看到列表中有1000行。但是我想看到在数组中插入一次之后,值应该直接显示在视图中

我一直在观察一次插入或类似的内容后列表视图的更新,但我找不到一些

任何想法

谢谢


Frank

您可能从文档中了解到,ListView API在当时仍处于构建和实验阶段。在您的情况下,可能会有帮助的是,在附加项目后立即调用私有的、因此未记录的ListView方法\u trigger\u reset\u populate:

x.adapter.data.append(‘frank’)
x._trigger_reset_populate()

关键是多线程

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))
那很好