How can i store button color with TINYDB

(Piaomi Türkiye) #1

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

#2

Show what you tried please.

(Piaomi Türkiye) #4

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

#5

This works for me

2 Likes
(Piaomi Türkiye) #6

i try now…

(Piaomi Türkiye) #7

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

#8

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.

(Farhad Stanekzay) #9

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.

(Yusuf Cihan) #10

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.

(Piaomi Türkiye) #11

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

(Vishwas Adiga) #12

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)

1 Like
(Piaomi Türkiye) #13

I will test this