gpt4 book ai didi

python kivy异步存储

转载 作者:行者123 更新时间:2023-12-01 04:54:29 24 4
gpt4 key购买 nike

我的应用程序使用同步 JsonStorage,并希望切换到异步。

我的同步通话是:

store.exists(store_index)

我不工作的异步调用是:

def callback_function(store,key,result):
print "exists:",result

store.exists(store_index, callback=callback_function)

此异步调用引发以下异常:

store.exists(key=store_index,callback=callback_function)
TypeError: exists() got an unexpected keyword argument 'callback'

我也尝试过这个:

store.async_exists(store_index, callback=callback_function)

但这提出了:

File "main.py", line 199, in __init__  store.async_exists(key=store_index,callback=colorButtonCallback)
File "/home/mike/Dokumente/py-spielwiese/venv/local/lib/python2.7/sitepackages/kivy/storage/__init__.py", line 152, in async_existskey=key, callback=callback)
TypeError: _schedule() got multiple values for keyword argument 'callback'

我做错了什么?

最佳答案

这是 Kivy 中的一个错误。您上次的尝试几乎是正确的(相当于@Anzel的答案中的代码,尽管@Anzel的代码是编写相同内容的更好方法)。但最终你仍然会收到 _schedule 抛出的错误。我刚刚submitted a PR在 kivy-dev 中修复这个问题。

关于python kivy异步存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27745932/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com