保存kivy应用数据 [英] Save app data in kivy

查看:425
本文介绍了保存kivy应用数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我是做健身应用,在那里你可以让你出来锻炼。当你配置锻炼你想保存它。如何添加这个功能,所以,当他退出应用程序,并再次打开它,他可以看到他的训练?

Say I was making a fitness app where you can make your out workout. When you have configured the workout you would want to save it. How do I add this function so that when he exits the app and opens it again, he can view his workouts?

我在Android上工作的专门

I am working specifically on Android.

这可以用来保存本地游戏保存和数据。

This could be used to save local game saves and data.

在此先感谢!

推荐答案

我相信Kivy具有与此有关系的模块。虽然它仍然是(在写作的时候)的实验。看看这里: http://kivy.org/docs/api- kivy.storage.html#module-kivy.storage

I believe Kivy has a module that deals with this. Though it is still(at the time of writing) experimental. Look here: http://kivy.org/docs/api-kivy.storage.html#module-kivy.storage

它们似乎使用味酸来存储数据,根据此。

They appear to be using Pickle to store the data, according to this.

如果不出于某种原因,
怎么样用泡椒/ cPickle的自己吗?如果你不知道这些是什么,谷歌现在他们。
然后,你可以存储用户设置或锻炼在一个字典和腌制的字典,大大节省了
信息以SD卡作为一个简单的文本文件,它不应该占用太多的空间都没有。

If that doesn't work for some reason, what about using Pickle/cPickle yourself? If you don't know what those are, Google them now. Then you could store user settings or workouts in a dict and pickle that dict, saving the info to the sdcard as a simple text file, which shouldn't take up much space at all.

据我所知,cPickle的是由于正在用C或可能用Cython到一个更快的实现味酸的,我不知道。希望所有的这有助于。

As far as I know, cPickle is a faster implementation of Pickle due to being written in C or possibly Cython, I am not sure. Hope any of this helps.

值得注意,它可能将文本文件保存到Android设备。我最近与Kivy一个游戏,我做了这一点,以纯文本格式存储高分。

It's worth noting that it's possible to save text files to the Android device. I recently made a game with Kivy where I was doing just that, storing high scores in plain text.

这篇关于保存kivy应用数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆