如何在不重新 运行 KIVY 应用程序的情况下自动更新或重新加载 KIVY 以从 sqlite3 获取数据

How to autoupdate or reload KIVY to fetch data from sqlite3 without re running the KIVY application

我创建了一个简单的应用程序,可以将数据添加到数据库 (sqlite)。

Button : Just an add button

TexInput: Input names

Spinner: show update of names

一切正常,正在添加到数据库并从数据库中获取数据。

我现在的问题是如何更新我的微调器来更新它的值而不用 关闭或重新运行 kivy 应用程序。

谢谢。

只需更新 Spinner values 属性

values = [r[0] for r in cursor.fetchall('select name from stuff_table')]
spinner.values = values #this will update the choices available
spinner.text = spinner.values[0]# choose default value...