Save File Button

Hi, I was wondering how to make a button on my app that saves the app progress. How do I do that?

1 Like

Make a TinyDB tag for each global variable and for each thing you changed on the screen, and save them all.

Restore them when your app restarts.

2 Likes

Could you explain a little more?

1 Like
2 Likes

What do you mean for app progress ? Could you explain a little more?

1 Like

It might be a game; OP might want the app to save which level you are on.

1 Like

The app is a clicker game so I would like to save the amount of clicks (represented on a button with text on it) to save.

2 Likes

You have to save only one value in your tinydb

How do I do that?

Does this work?Screenshot 2021-11-07 5.55.44 PM

1 Like

It will, but only if Counter_Button's text/value is updated each time you click the Button.

That's all I need

Do you want to update the Button's text or a separate label's text?

This won't work, if your intention is to save number of clicks, you should arrange your blocks this way

1 Like

Here, Counter_Button is just representing specific button object only, when we use dot operator to get value of specific property, that is returned.

image

To get property, we do
image

1 Like

This is what I put for when the button is clicked. Do I just put the .StoreValue by it? (Eddie is the click button)Screenshot 2021-11-08 10.32.04 AM

Values used on both side of an operator, should be of same type, this is not there

image

1 Like

If Eddie is click button then what's purpose of Counter_Button, use a globle variable instead, to keep count of clicks as I shown in earlier example code.

Since, with mathematical + you can have both operands as numbers only, else you will get error.

1 Like

The code didn't work @RamNaresh.

Please share your findings, where it doesn't work.