Reply To: Change value in a list

Welcome to Taipy Forums Taipy GUI Change value in a list Reply To: Change value in a list

#236844
Florian JactaFlorian Jacta
Keymaster

Hi,
Taipy doesn’t support this kind of assignment, you should use an ‘equals’ assignment to see changes in real-time. This principle is also used for other elements such as Pandas DataFrame or dictionaries. Your code will look like this:

from taipy import Gui

list_a = [1,2,3]

md = “””
<|Add value|button|on_action=add_value|>

<|{list_a}|>
“””

def add_value(state):
print(“Before”, state.list_a)
state.list_a += [4]
print(“After”, state.list_a)

Gui(md).run()