Welcome to Taipy › Forums › Taipy GUI › Change value in a list › Reply To: Change value in a list
October 27, 2022 at 1:08 pm
#236844
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()