How can i store button color with TINYDB

i search this but i cant find. also i tried this.

Show what you tried please.

Ekran%20Al%C4%B1nt%C4%B1s%C4%B1

This works for me

4 Likes

i try now…

i want it is automatic. always . (bad english)

What do you mean automatic? That it is loaded on the start of the app?

Put the set background color in the screen initialize block.

You could store the actual colour block like Peter showed if you assign it yourself. If you mean automatic in terms of storing the current background colour then I would have assumed that your method would have worked, if not can someone explain? But if you are assigning a colour each time (not randomly etc) then just store the colour block you use.

This should work, just use Tiny_DB.Get Value with “renk” key to get the latest saved color whenever you want.

Also, you can use always use a translator if your English is bad.

what I mean is that clicking that button will change the color and it will stay.

You can use the when button.click block to detect clicks on the button. You can store the button’s background colour using TinyDB inside that event.

When your screen initialises, you can restore the button’s background colour by getting the value from TinyDB. I suggest you also have a fallback colour for if not found. (If your app is running for the first time, then the TinyDB value will not have been saved, so no colour will be returned. The fallback colour is used when there’s no valid colour in the TinyDB storage)

2 Likes

I will test this

As read, it sounds workable, could you give a screenshot of the blocks? I’m a little savvy and trying to figure out a database, but so far, alas, it’s not working

2 posts were merged into an existing topic: Save button color in Tinydb