I am a beginner working on one of my first projects and i came across a problem.
i made a list in blocks and the items include quotes, ig , and i wanted to take one of those items
and display it in the label i had created in my app but it randomly starts changing the text every second. it wont stay one quote and changes rapidly. how do i keep it one at a time?
Hi
i actually found out that i had a code for this in another part of my blocks and that was causing a bug so i deleted those and now its working fine
Thanks for trying to help tho!
The label is undefined because you are asking it to display a list item from a list that hasn’t yet been defined. In this screenshot, app variable list display has no value so the list item assigned to app variable quote is undefined.
not only that - you have to switch the statement 1 and 2 inside the block - ie. you need to get a random index first before you can use it to obtain an item in the app_variable_list_display.
also, the code you have in the allthoughts screen, where you load the thoughts list with the correct set (according to time of day) should be placed in 3 places in home screen:
during start
inside your when_shuffle_click in the home screen.
the same can be placed inside the when_allthoughts_clicked , but without the set_label statement - for you just want allthoughts screen to simply display what is the current thoughts list.
you can pack into a function that you can call in those 3 places.
You are initializing app variable list display to an empty list on the “All thoughts” screen. But that screen comes after the “Home screen” screen. So on the Home screen where you are trying to get an item from that list, that’s going to fail. Even if it did work, it would be an empty list.
What are you expecting the value of these blocks to be?